• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get the complete path of file from android application

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this help: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
 
Mohit G Gupta
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
no wonder he is so sad, he hasn't seen this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic