Android, how to choose save file location?

前端 未结 3 1168
孤独总比滥情好
孤独总比滥情好 2021-02-14 09:05

is there any solution how to choose the saving files location? maybe with the original file browser, to choose the destination?

thank you!

3条回答
  •  佛祖请我去吃肉
    2021-02-14 09:29

    Better to save files with your app namespace:

    String extStorage = Environment.getExternalStorageState();
    path = extStorage+"/Android/data/com.mydomain.myapp/";
    

    It will be deleted when app gets uninstalled.

    Here is actually everything about data storing.
    http://developer.android.com/guide/topics/data/data-storage.html

    From the above link:

    If you're using API Level 7 or lower, use getExternalStorageDirectory(), to open a File representing the root of the external storage. You should then write your data in the following directory:

    /Android/data//files/
    

提交回复
热议问题