在我的应用程序,我最初加载从画廊,即(MediaStore.Images.Media.EXTERNAL_CONTENT_URI)所有影像
in my app, i initially load all the images from the gallery, i.e. (MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
用户可以通过我的应用程序拍照,但我有一个自定义的摄像头,也就是我不使用默认的手机摄像头拍照,我有我自己的表面来看,我处理Camera对象直接,处理摄像头的画面。我保存这个形象在自定义文件夹。
user can take picture via my app, but i have a custom camera, i.e. i do not use default phone camera to take pictures, i have my own surface view, i deal with Camera object directly, and handle the camera picture. and i save this image in a custom folder.
我想在新拍摄的照片出现在我的画廊,一旦用户返回到我的应用程序
i want the newly taken picture to appear in my gallery once user returns to my app
问题: 新拍摄图像没有出现在光标我装入MediaStore.Images.Media.EXTERNAL_CONTENT_URI
problem: the newly taken picture does not appear in the cursor i loaded with MediaStore.Images.Media.EXTERNAL_CONTENT_URI
这个问题只走了,当我重新安装应用程序,并强制重新扫描。
the problem is gone only when i reinstall the app and force a rescan.
我该如何解决这一问题?我想,立即采取会出现在我的光标每一个画面?
how do i fix this? i want every picture that was immediately taken will appear in my cursor?
我已经做了一些researhc,但不要告诉我contentvalues中包含
i have done some researhc, but don't tell me the contentvalues with the startactivity solution like below
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
这是不行的,因为再次,我有我自己的相机,我不使用默认的摄像头活动从手机
this does not work, because again, i have my own camera, i am not using the default camera activity from the phone
我也试过
getContentResolver().notifyChange(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null);
这也不行
有人可以帮忙吗?
感谢
您只需要发送一个广播ACTION_MEDIA_SCANNER_SCAN_FILE,这样的mediascanner可以为你保存的图像扫描。
You just need to send an broadcast "ACTION_MEDIA_SCANNER_SCAN_FILE" so that the mediascanner can scan for the image you saved.
Intent mediaScanIntent = new Intent( Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
mediaScanIntent.setData(uri);
sendBroadcast(mediaScanIntent);
刚刚成立的新创建的图像的URI。 :)
just set the uri of the the newly created image. :)
上一篇:CSS:悬停后过渡CSS
下一篇:文本到语音蓝牙蓝牙、语音、文本