Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the file name from the intent?

This is my manifest file. After using intent filter i download the ics file from the mail attachment. When i open the downloaded file it start my application. I need to get the file name and data of the selected file in my application. What should i do in the manifest and the java file. I am very new to android can any one help me????

<application android:label="@string/app_name" android:icon="@drawable/icsicon">
    <activity android:name=".setMIMEfile" android:label="@string/app_name">
     <intent-filter>
         <action android:name="android.intent.action.VIEW" />
         <category android:name="android.intent.category.DEFAULT" />
         <data android:mimeType="*/*" />
        <data android:pathPattern=".*\\.ics" />    
     </intent-filter>
</activity>
like image 720
Sumithran Avatar asked Jun 04 '10 06:06

Sumithran


1 Answers

Intent intent = getIntent();                
String name = intent.getData().getPath();

String name will contain your selected file path, from that path you can read your file

like image 55
Karthick Avatar answered Oct 15 '22 08:10

Karthick