altosdroid: Attempt to avoid some reported altosdroid crashes
authorKeith Packard <keithp@keithp.com>
Mon, 16 Apr 2018 16:45:35 +0000 (09:45 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 27 Apr 2018 02:24:21 +0000 (19:24 -0700)
Just looking at stack traces, maybe these changes will avoid some problems?

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java
altosdroid/src/org/altusmetrum/AltosDroid/SetupActivity.java

index 7130989..ec73f5e 100644 (file)
@@ -63,7 +63,10 @@ public abstract class AltosDroidTab extends Fragment implements AltosUnitsListen
                        show(last_telem_state, last_state, last_from_receiver, last_receiver);
                } else
                        ft.hide(this);
-               ft.commitAllowingStateLoss();
+               try {
+                       ft.commitAllowingStateLoss();
+               } catch (IllegalStateException ie) {
+               }
        }
 
        @Override
index d970fc4..6c2d9d7 100644 (file)
@@ -256,6 +256,12 @@ public class SetupActivity extends Activity {
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
 
+               AltosDebug.init(this);
+               AltosDebug.debug("+++ ON CREATE +++");
+
+               // Initialise preferences
+               AltosDroidPreferences.init(this);
+
                // Setup the window
                requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                setContentView(R.layout.setup);