我需要在Android设备上加载文件(我的模型)。我用
FileReader fr = null;
try {fr = new FileReader(new File(path));} catch (Exception e) {}
BufferedReader reader =...
文件的正确路径是什么(比如你从哪个文件夹开始)。此外,保留模型或其他文本文件的标准位置也在哪里。
答案 0 :(得分:0)
外部存储是一个好地方:
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;
}