1

I'm trying to test for file chooser availability. I assumed an error would be returned if none was available, however, this is not the case.

Here's my code:

public void doImport() {
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("file/*");
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        try {
            startActivityForResult(Intent.createChooser(intent, "Select a File to Import"), IMPORT_RACES_CODE);
            } catch (android.content.ActivityNotFoundException ex) {
                // Potentially direct the user to the Market with a Dialog
                Utils.Error(this, "THERE WAS NO NAVIGATOR FOUND, Install a navigator!");
            } catch (Exception e) {
                Utils.Error(this, "Some other error occurred!");
        }
    }

No Exception is being sent back to my routine, though. The OS seems to be handling the error and generating a dialog box stating "No apps can perform this action."

Any idea what I'm doing wrong here?

Thanks!

TonyMLake
  • 67
  • 1
  • 9

1 Answers1

0

Actually, found the answer in this thread:

Android : Can I use this intent from a 3rd party application?

See the "isIntentAvailable" routine posted by the responder.

Thanks, all!

Community
  • 1
  • 1
TonyMLake
  • 67
  • 1
  • 9