0
我實現了一個應用程序捕獲圖像並將它們保存到我的自定義文件夾。一切都還好,但問題是,當我捕捉圖像時,我的畫廊不會同步。這意味着畫廊不會顯示新的拍攝圖像。爲此,我需要重新啓動我的手機。如何捕獲一個新的圖像保存到自定義文件夾同步android廚房
這裏是我的圖像捕捉代碼....
if (requestCode == 0 && resultCode == RESULT_OK) {
String[] projection = {MediaStore.Images.ImageColumns.SIZE,
MediaStore.Images.ImageColumns.DISPLAY_NAME,
MediaStore.Images.ImageColumns.DATA,
BaseColumns._ID,
MediaStore.Images.ImageColumns.DATE_ADDED};
final String imageOrderBy = MediaStore.Images.Media._ID + " DESC";
final String selection = MediaStore.Images.Media.DATE_TAKEN + " > " + time;
Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
CursorLoader loader = new CursorLoader(this, u,
projection, selection, null, imageOrderBy);
Cursor cursor = loader.loadInBackground();
if (null != cursor && cursor.moveToFirst()) {
ContentResolver cr = this.getContentResolver();
cr.delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
BaseColumns._ID + "=" + cursor.getString(3), null);
}
//showing image in image view
cameraPicture = output.getPath();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
Bitmap bitmap = BitmapFactory.decodeFile(cameraPicture, options);
binding.imageView.setImageBitmap(bitmap);
binding.imageView.setVisibility(View.VISIBLE);
}
所以我怎樣才能同步我的Android廚房時,我捕獲圖像???這樣我就可以立即從廚房看到這個圖像。
沒有什麼在你的問題涉及「捕獲圖像,並將它們保存到我的自定義文件夾」後,通知系統。 – CommonsWare
對不起,我是新的,這是我的第一個問題。所以我不知道如何發佈一個問題和stackoverflow顯示我的錯誤。所以在這裏複製我的onresult代碼。 – Rhidoy