@@ -9,19 +9,31 @@ def setContentView(new_activity, new_screen):
99 global screen_stack
1010 if screen_stack :
1111 current_activity , current_screen , current_focusgroup , _ = screen_stack [- 1 ]
12- current_activity .onPause (current_screen )
13- current_activity .onStop (current_screen )
12+ try :
13+ current_activity .onPause (current_screen )
14+ except Exception as e :
15+ print (f"onPause caught exception: { e } " )
16+ try :
17+ current_activity .onStop (current_screen )
18+ except Exception as e :
19+ print (f"onStop caught exception: { e } " )
1420
1521 from .util import close_top_layer_msgboxes
1622 close_top_layer_msgboxes ()
1723
1824 screen_stack .append ((new_activity , new_screen , lv .group_create (), None ))
1925
2026 if new_activity :
21- new_activity .onStart (new_screen )
27+ try :
28+ new_activity .onStart (new_screen )
29+ except Exception as e :
30+ print (f"onStart caught exception: { e } " )
2231 lv .screen_load_anim (new_screen , lv .SCR_LOAD_ANIM .OVER_LEFT , 500 , 0 , False )
2332 if new_activity :
24- new_activity .onResume (new_screen )
33+ try :
34+ new_activity .onResume (new_screen )
35+ except Exception as e :
36+ print (f"onResume caught exception: { e } " )
2537
2638def remove_and_stop_all_activities ():
2739 global screen_stack
@@ -31,9 +43,18 @@ def remove_and_stop_all_activities():
3143def remove_and_stop_current_activity ():
3244 current_activity , current_screen , current_focusgroup , _ = screen_stack .pop ()
3345 if current_activity :
34- current_activity .onPause (current_screen )
35- current_activity .onStop (current_screen )
36- current_activity .onDestroy (current_screen )
46+ try :
47+ current_activity .onPause (current_screen )
48+ except Exception as e :
49+ print (f"onPause caught exception: { e } " )
50+ try :
51+ current_activity .onStop (current_screen )
52+ except Exception as e :
53+ print (f"onStop caught exception: { e } " )
54+ try :
55+ current_activity .onDestroy (current_screen )
56+ except Exception as e :
57+ print (f"onDestroy caught exception: { e } " )
3758 if current_screen :
3859 current_screen .clean ()
3960
0 commit comments