0

I'm need to load a file(my model) on android device. I use

FileReader fr = null;
try {fr = new FileReader(new File(path));} catch (Exception e) {}
BufferedReader reader =...

what would be the correct path for the file(like what folder do you start from). Also where would the standard place for keeping models or other text files be.

Shadow
  • 1
  • 5
  • sdcard/yourapp/files , normally external storage your app name and place them how ever inside that folder – surya Sep 20 '16 at 00:33

1 Answers1

0

External storage is a good place for it:

    public static File getMyFilePath(String filename){
        SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd_HH.mm.ss.S");
        return new File(getDirectory(context, VIDEO_DIR),fileName);
    }
    private static File getDirectory(Context ctx, String path){
        File f=new File(context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()+path);
        f.mkdirs();
        return f;
    }
Gogi Bobina
  • 1,086
  • 1
  • 8
  • 25