Code to launch an app from a given list in Android

Viewed 32

If I have a list of apps installed on the Android device, how can I let the user choose one from the list and launch it (like when open a pdf file, the device will ask you which app do you want to use to open it).

Thanks,

1 Answers

I don't sure about your question. But in case open pdf file , you can add action.VIEW in your manifest:

    <application>
        <activity ...>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="application/pdf" />
            </intent-filter>
        </activity>
    </application>

Now, when you choose a pdf in list file, your application will be in the list of applications that can open pdf files

Hope this helps you

Related