how to read file from the phone memory in android? -


i need read file phone memory.how read file ?can me??

here's how write in file..

fileoutputstream fos = openfileoutput("urls.txt", context.mode_private); fos.write("alex".getbytes()); fos.close(); 

here's how read file:

fileinputstream fis = openfileinput("urls.txt"); int c; while((c=fis.read())!=-1)         {              k += (char)c;         } fis.close(); 

string k contain "ankit" string.

mind you.. file "urls.txt" gets formed in phone memory, cannot access file in project resource.

for more information see: http://developer.android.com/guide/topics/data/data-storage.html#filesinternal


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -