Search code examples
androidintentfilter

Application not being displayed in the list of default apps on device


I am trying to write a photo viewer application and have put the below in my Manifest file

<activity
        android:name="com.example.testimageintent.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>  
            <action android:name="android.intent.action.VIEW">  
                <category android:name="android.intent.category.DEFAULT">
                    <data android:mimeType="image/*"/>
                </category>
            </action>
        </intent-filter>
    </activity>

The idea was to list this app in the list of available applications when the user tries to open an image from the file browser. Somehow my app is never listed in that list. I can still see the gallery and other apps in the list but my app never appears. Any pointers to what i might be doing wrong?


Solution

  • Sorry Guys, it's my mistake. I have nested the Action, Category and the Data blocks. They should be independent of each other. It works fine once i have them as individual tags like below:

    <action android:name="android.intent.action.VIEW"/>  
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="image/*"/>