Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the complete path of file from android application

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic