iPaulPro / aFileChooser

[DEPRECATED] Android library that provides a file explorer to let users select files on external storage.
Apache License 2.0
1.79k stars 850 forks source link

Start the FileChooserActivity directly #26

Closed AdminBWF closed 10 years ago

AdminBWF commented 10 years ago

Hi,

sorry, that I ask with a little problem like this.

Im not able to start the FileChooserActivity directly. At the moment it is configured like the aFileChooserExample.

private void openFile() {
    // Use the GET_CONTENT intent from the utility class
    Intent target = FileUtils.createGetContentIntent();

    // Create the chooser Intent
    Intent intent = Intent.createChooser(
            target, getString(R.string.chooser_title));

    try {
        startActivityForResult(intent, REQUEST_CODE);

    } catch (ActivityNotFoundException e) {
         //The reason for the existence of aFileChooser
    }
}

I dont want to see the other possibilitys (Music, photos,...) and start the aFileChooser directly.

I tried with :

    private void openFile() {
        Intent in = new Intent("com.ipaulpro.afilechooser.FileChooserActivity");
        startActivityForResult(in, REQUEST_CODE);
    }

or:

    private void openFile() {
        Intent in = new Intent("android.intent.action.GET_CONTENT");
        startActivityForResult(in, REQUEST_CODE);
    }

But I get this message on start:

E/AndroidRuntime(22091): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.ipaulpro.afilechooser.FileChooserActivity }

Can someone tell me, what changes I need?

Thank you very much

shaunidiot commented 10 years ago

Not sure if I'm right, but had a problem that is similar to this. Please try adding "com.ipaulpro.afilechooser.FileChooserActivity" as an activity into YOUR project's manifest IF you haven't :)

EDIT : ReadMe.MD. Add this into your manifest.

<activity
    android:name="com.ipaulpro.afilechooser.FileChooserActivity"
    android:icon="@drawable/ic_chooser"
    android:label="@string/chooser_label" >
    <intent-filter>
        <action android:name="android.intent.action.GET_CONTENT" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.OPENABLE" />

        <data android:mimeType="*/*" />
    </intent-filter>
</activity>
AdminBWF commented 10 years ago

I think I have exactly the same in my manifest.

I can start the aFileChooser like in the Example without problems, but not directly. I always get the Chooser with Music, photos, other file browsers,... and the aFileCooser.