Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Let suppose there is a image or text file. On clicking a file , i want to open a particular image or text file to open in my android app by default . Please someone help.

What I have tried:

I know by listview method where i will first open my app and then show list of particular extension files and then open it in my imageview by clicking on listview item. But i want to simply open it in my app by simply clicking a file while browsing.
Posted
Comments
David Crow 30-Jun-20 12:26pm    
Your app needs to be "registered" for that type of file. When I tap on a text file whilst browsing, I've got an app that comes up as one of the possible "Open With" choices. I had code similar to the following in the AndroidManifest.xml file:

<application
    android:allowBackup="true"
    android:icon="@drawable/flag"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name=".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="text/plain" />
        </intent-filter>
        
    </activity>
</application>
Vivek Kansal 30-Jun-20 13:59pm    
ok Thank you so much sir for your reply
Vivek Kansal 30-Jun-20 14:16pm    
thank you once again that's the perfect answer i am looking for

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900