• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps File creation

Hi,

I am new to Android debelopment. I want to write an application which reads from a file stored on the device (Like a configuration file) and takes necessary actions. Here my problem is with respect to the file creation.. Where is the file getting vreated. I used

File file = new file("/data/data/myApp");
file.mkdir();

File file = new file("data/data/myApp/textFile");
file.Createfile();

I am not able to see any new file getting created??Can any one help me please??
 
Give the method Context.getDir(path, mode) a try. It seems to create a directory on the device well, but the phone controls the specific name that's ultimately used.

Code:
getDir("test", Context.MODE_WORLD_READABLE)

seems to create a directory called "app_test". This suggests you have to use Context functions to manage files.

Hope that helps...
 
Back
Top Bottom