import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Dialog;
+import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
Intent openIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
openIntent.setType("*/*");
openIntent.putExtra(Intent.EXTRA_MIME_TYPES, ACCEPTED_MIME_TYPES);
- startActivityForResult(openIntent, OPEN_DOCUMENT);
+ try
+ {
+ startActivityForResult(openIntent, OPEN_DOCUMENT);
+ }
+ catch (ActivityNotFoundException e)
+ { /* some devices are unable to browse for files */
+ finish();
+ return;
+ }
}
}
import android.app.Activity;
import android.app.LoaderManager;
+import android.content.ActivityNotFoundException;
import android.content.AsyncTaskLoader;
import android.content.ContentResolver;
import android.content.Context;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.lang.OutOfMemoryError;
import java.net.URL;
import java.net.UnknownHostException;
import java.security.KeyStore;
{
Intent openIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
openIntent.setType("*/*");
- startActivityForResult(openIntent, OPEN_DOCUMENT);
+ try
+ {
+ startActivityForResult(openIntent, OPEN_DOCUMENT);
+ }
+ catch (ActivityNotFoundException e)
+ { /* some devices are unable to browse for files */
+ finish();
+ return;
+ }
}
if (savedInstanceState != null)