我想将图像保存在所有手机的相同路径中。我的代码是路径
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)
{
File fil = new File(c.getFilesDir().getPath()+File.separator+"HMS_BARCODE");
fil.mkdirs();
//and i have created for both external and internal
//here r the paths coming from mobiles
String imageInSD = "/storage/sdcard0/HMS_BARCODE/"+ Barcode +".PNG";
String imageInSD1 = "/storage/emulated/0/HMS_BARCODE/"+ Barcode +".PNG";
}
答案 0 :(得分:0)
尝试使用
Environment.getExternalStorageDirectory()
答案 1 :(得分:0)
如果您拥有Context
,则可以使用
context.getExternalFilesDir(null).getAbsolutePath();
您将拥有存储路径:/ Android / data / packagename / files /