tags:

views:

78

answers:

2

In windows text files are displayed with notepad icon. When we double click the particular file it open’s the notepad and displays the file. Like that I need to open the file from the download folder in android. I have used the intent-filter for register my ics file’s mime type. When I select the file in the download folder it just opens my application only. At that time I need to open / read the selected file. How to do this? I am new to android Can anyone help me?

A: 

You can determine the Intent your activity was fired with by calling getIntent(), and you can access the data for that Intent (in this case, likely a URI), by calling getIntent().getData(). Also, the action is likely ACTION_VIEW, but you probably know this already if you've set up your <intent-filter> properly.

Roman Nurik
A: 

When your application is called, it is supplied an Intent.

You can get the file name from the intent that is supplied to your application and open the file using new FileInputStream(String filename).

You can now read the data from this stream as you normally would in Java.

P.S. Make sure your application has enough permissions to access the file. You may need to declare the required permissions in your manifest.

codinguser
Thanks for your response
Karthick