Esempio n. 1
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
      // We can read and write the media

      try {
        url = (String) getIntent().getExtras().get(Intent.EXTRA_TEXT) + "#view:list";
      } catch (Exception e) {
        url = "https://www.dropbox.com/s/8owsfcia59ko76i#view:list";
        // Used for testing if it's not opened from the dropox action menu
        // Obviously what needs to happen here is a message suggesting that the user use the dropbox
        // app, and a textbox in case they've got the url copied.
      }

      showDialog(
          PROGRESS_DIALOG); // Do the work in a separate thread so we can update the UI
                            // simultaneously.

    } else {
      // Can't write files, so show a message and quit.

    }
  }
 /* Checks if external storage is available to at least read */
 public boolean isExternalStorageReadable() {
   String state = Environment.getExternalStorageState();
   if (Environment.MEDIA_MOUNTED.equals(state)
       || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
     Log.d("FileWriter", "External Readable");
     return true;
   }
   Log.d("FileWriter", "External Not Readable");
   return false;
 }