altosdroid: Move bluetooth check to first task
authorMike Beattie <mike@ethernal.org>
Thu, 30 Aug 2012 09:08:06 +0000 (21:08 +1200)
committerMike Beattie <mike@ethernal.org>
Thu, 30 Aug 2012 09:08:06 +0000 (21:08 +1200)
Signed-off-by: Mike Beattie <mike@ethernal.org>
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java

index 7d6a8044d2a3d1c0598473af64e5957629aa47bf..bc129feed576a4e0b758e5f4641918dcba567c72 100644 (file)
@@ -216,6 +216,16 @@ public class AltosDroid extends Activity {
                super.onCreate(savedInstanceState);
                if(D) Log.e(TAG, "+++ ON CREATE +++");
 
+               // Get local Bluetooth adapter
+               mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+
+               // If the adapter is null, then Bluetooth is not supported
+               if (mBluetoothAdapter == null) {
+                       Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
+                       finish();
+                       return;
+               }
+
                // Set up the window layout
                requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
                //setContentView(R.layout.main);
@@ -247,16 +257,6 @@ public class AltosDroid extends Activity {
                mLatitudeView  = (TextView) findViewById(R.id.latitude_value);
                mLongitudeView = (TextView) findViewById(R.id.longitude_value);
 
-               // Get local Bluetooth adapter
-               mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
-
-               // If the adapter is null, then Bluetooth is not supported
-               if (mBluetoothAdapter == null) {
-                       Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
-                       finish();
-                       return;
-               }
-
                // Enable Text to Speech
                tts = new TextToSpeech(this, new OnInitListener() {
                        public void onInit(int status) {