Location CSV files in Android

I am having trouble reading from a .CSV file in an Android app. Mostly a "FileNotFound" error. Where would be the easiest place to place the file, and what would be the address for it. I was messing around with several different places, but no luck.

Can someone point me in the right direction?

+3
source share
1 answer

You will probably want it on removable media (SD card). First you want to check if the storage is available, and then read / write.

: http://developer.android.com/intl/de/guide/topics/data/data-storage.html#filesExternal ( API 8, getExternalFilesDir, , , >= 8.)

, - :

public boolean isExternalStorageAvail() {
      return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
   }

( ) .

:

File f = new File(Environment.getExternalStorageDirectory() + "/mycsvlocation/myfile.csv");

File, , , .., .

, SD-, "Android/data//files", , "/appname/" .

- , , SD- , . , ( ), , , .

+1

Source: https://habr.com/ru/post/1767783/


All Articles