开发者

Android path not getting

开发者 https://www.devze.com 2023-03-17 03:05 出处:网络
When I am dealing with an iPhone application, I know where the sandbox of the application is stored and when I save somethingI can easily access the document directory of my application.

When I am dealing with an iPhone application, I know where the sandbox of the application is stored and when I save something I can easily access the document directory of my application.

But, in android, I don't know what is the similar thing to it, so can anybody let开发者_如何学运维 me know where this file will be stored and how can I can get the access to it?


it'll be stored in your workspace under the folder with projects name


You can read some general information about resources in android here: http://developer.android.com/guide/topics/resources/index.html

To access internal storage of the deviace:

For reading:

InputStream is = getContext().openFileInput(filename);

For saving:

    FileOutputStream fos = getContext().openFileOutput(filename, Context.MODE_PRIVATE);
    ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fos));
    out.writeObject(survey);
    out.close();

If you use eclipse you can browse files using DDMS perspective (Window->OpenPerspective->Other->DDMS).

0

精彩评论

暂无评论...
验证码 换一张
取 消