Ashok, you will not be able to create files to the /data directory since that is a system level directory. You can, however, create files within your application's data directory. Get a reference to the Context and use the cache directory (getCacheDir()) or the files directory (getFilesDir()).
On Dec 29, 4:36 am, "Ashok Kumar" <vak...@gmail.com> wrote: > Hi,I am trying to create a new file using the class File. > Below is my code snippet > > File testFile = new File("/data/tests.txt"); > if (!testFile.exists()) { > System.out.println("--------------File does not exist: "); > > } > > Initially I don't have the file tests.txt under data path. So, I am trying > to create it.After creating the file I am making a check is the file exists > or not. But it is says that file doesn't exist. > Can any one please help me out or how to create a new file and write data > into that file. > > Thanks > Ashok.V --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---