]> git.gag.com Git - debian/openrocket/blobdiff - android/src/net/sf/openrocket/android/Main.java
Added simple file browser functionality used when there are no applications installed...
[debian/openrocket] / android / src / net / sf / openrocket / android / Main.java
index bd80c9fd050cc0fe921e87732b2ad79fa53501c2..cdb7366a000a7772c4c01e85f913c304a90ae4e0 100644 (file)
@@ -1,13 +1,14 @@
 package net.sf.openrocket.android;\r
 \r
 import net.sf.openrocket.R;\r
+import net.sf.openrocket.android.filebrowser.SimpleFileBrowser;\r
 import net.sf.openrocket.android.motor.MotorHierarchicalBrowser;\r
 import android.app.Activity;\r
+import android.content.ActivityNotFoundException;\r
 import android.content.Intent;\r
 import android.net.Uri;\r
 import android.os.Bundle;\r
 import android.view.View;\r
-import android.view.Window;\r
 \r
 public class Main extends Activity {\r
 \r
@@ -39,9 +40,15 @@ public class Main extends Activity {
        }\r
 \r
        public void pickOrkFiles( View v ) {\r
-               Intent intent = new Intent(Intent.ACTION_GET_CONTENT);\r
-               intent.setType("file/*");\r
-               startActivityForResult(intent,PICK_ORK_FILE_RESULT);\r
+               try {\r
+                       Intent intent = new Intent(Intent.ACTION_GET_CONTENT);\r
+                       intent.setType("file/*");\r
+                       startActivityForResult(intent,PICK_ORK_FILE_RESULT);\r
+               } catch ( ActivityNotFoundException ex ) { \r
+                       // No activity for ACTION_GET_CONTENT  use internal file browser\r
+                       Intent intent = new Intent(Main.this, SimpleFileBrowser.class);\r
+                       startActivityForResult(intent,PICK_ORK_FILE_RESULT);\r
+               }\r
        }\r
 \r
        public void browseMotors( View v ) {\r