*
The moose likes Android and the fly likes How to get the complete path of file from android application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to get the complete path of file from android application" Watch "How to get the complete path of file from android application" New topic
Author

How to get the complete path of file from android application

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

i have multiple text files in my sdcard folder and i have build an activity that allows user to select the required file.



but stil,i have to use pass the filepath to file constructor(see line2).
textfile.java:

i want the second parameter ie filepath to be stored as string.
is there any way i can get the complete path of file selected .
The code i had used is as follows:

AndroindApplication .java:


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Does this help: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

JBoss In Action
Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

i need to get the absolute path so that i can pass it to




and don't have to specify the filepath in the code whenver a new file has to be opened

Is there anyway i can get it from AndroidApplication.java ?

THe link you gave was not much useful
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

I'm sorry, but I have no idea what it is that you want to do. You want the "absolute path" of what? The line of code you posted doesn't give me any clues either. Is it that you want to know what to set "sdcard" to?

Or are you saying you and the absolute path to ans.txt? If so, how is any code supposed to know that automatically since that file is one that you designate?

Perhaps if you posted the code you would like to write, rather than existing code...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to get the complete path of file from android application
 
Similar Threads
How to display Images stored on sdcard?
Problem with creating a simple Menu in Browser view.
Newbie - UI Help
getting null pointer
Unable to read more than one text files stored in sdcard