每当我保存图片时,都会转到/storage/emulated/0/tracker/imgname.jpg,但我想将其保存在/storage/emulated/tracker/imgname.jpg
Bitmap bitmap = BitmapFactory.decodeFile(uri.getPath());
File dir = new File(Environment.getExternalStorageDirectory() + "/Tracker");
dir.mkdir();
File file = new File (dir, "img" + System.currentTimeMillis() + ".jpg");
try {
FileOutputStream out = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
mediaScanIntent.setData(uri);
context.sendBroadcast(mediaScanIntent);