File creation

  1. Raviraj2018

    Raviraj2018 New Member


    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 file = new file("data/data/myApp/textFile");

    I am not able to see any new file getting created??Can any one help me please??

  2. rschilling

    rschilling New Member

    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