1. Check out our app, Forums for Android! Download and leave feedback here!

File creation

Discussion in 'Application Development' started by Raviraj2018, Dec 13, 2008.

  1. Raviraj2018

    Raviraj2018 New Member
    Thread Starter
    5

    Dec 13, 2008
    1
    0
    5
    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??
     

    Advertisement

  2. rschilling

    rschilling New Member
    5

    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 (Text):
    1. 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...
     

Share This Page

Loading...