Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Experimentation for Engineers: From A/B testing to Bayesian optimization
this week in the
Design
forum!
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
Ron McLeod
Tim Cooke
Paul Clapham
Liutauras Vilda
Sheriffs:
Junilu Lacar
Rob Spoor
Jeanne Boyarsky
Saloon Keepers:
Stephan van Hulst
Carey Brown
Tim Holloway
Piet Souris
Bartenders:
Forum:
Android
where is the files located in phone
shawn peter
Ranch Hand
Posts: 1325
1
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have below application.
package com.home.aruna; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class SharedFile extends Activity { final String TEST_STRING = new String("Aruna Sameera Liayanage"); final String FILE_NAME = "SAMPLEFILE.txt"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); fileCreate(); tv.setText(readFile()); setContentView(tv); } private void fileCreate() { try { OutputStream os = openFileOutput(FILE_NAME, MODE_WORLD_READABLE); OutputStreamWriter osw = new OutputStreamWriter(os); osw.write(TEST_STRING); osw.close(); } catch (Exception e) { Log.i("ReadNWrite, fileCreate()", "Exception e = " + e); } } private String readFile() { try { FileInputStream fin = openFileInput(FILE_NAME); InputStreamReader isReader = new InputStreamReader(fin); char[] buffer = new char[TEST_STRING.length()]; // Fill the buffer with data from file isReader.read(buffer); return new String(buffer); } catch (Exception e) { Log.i("ReadNWrite, readFile()", "Exception e = " + e); return null; } } }
This is working fine.So it create a file named SAMPLEFILE.txt.I need to know where iit is stored in phone.I search through the phone memory but unable to found.
Hardik Trivedi
Ranch Hand
Posts: 252
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
File is stored at application level
Go to data/data/<your packagename>/files
You will be able to see the file SAMPLEFILE.txt
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
error while connecting to webservices
Phone to phone/emulator comminication
Getting Onle One File when getting reponse through ksoap2 web service.
File outputted has size zero
Connecting to local Web Service from Android emulator does not work
More...