on api level 4 (android 1.6), after taking photo using:
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(Environment.getExternalStorageDirectory(), "NewPic.jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(intent, TAKE_PICTURE);
I'd like to look through all my photos thumbnails, but there is no my last photo thumbnail. It works perfectly on android 2.1.
If I connect device via USB to PC and then disconnect file will appear, after finished scanning. So how should I start that indexing?
I tried
mScanner = new MediaScannerConnection(getApplicationContext(), this);
mScanner.connect();
mScanner.scanFile(imageUri.getEncodedPath(), "*/*");
And end with this:
02-24 17:13:54.678: DEBUG/MediaScannerService(1320): IMediaScannerService.scanFile: /sdcard/NewPic2222.jpg mimeType: */*
02-24 17:13:54.688: VERBOSE/MediaProvider(1320): /sdcard volume ID: 1149784819
02-24 17:13:54.688: VERBOSE/MediaProvider(1320): key exists
EDITED LATER
I've got sth like this in other activity
mCursorThumbnails = MediaStore.Images.Thumbnails.queryMiniThumbnails(mContentResolver, MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, MediaStore.Images.Thumbnails.MINI_KIND, projection);
mCursorImages = MediaStore.Images.Media.query(mContentResolver, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection);
When I check count of first value I've got 13 elements, and on the second I've got 14. So the image has been added to mediascanner, but OS hasn't generated thumbnail for it. So how should I ask OS to create one?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…