防止摄像头在图库中捕获图像
问题描述:
如何防止android摄像头捕获图像出现在图库中或不存储在设备上的任何地方。我使用sqlite db来存储图像,在那里我没有任何问题。但我希望捕获的图像不会显示否则不会保存在设备上。防止摄像头在图库中捕获图像
答
你可以把你自己的逻辑到被调用的处理程序,只要你从摄像机捕获的图像:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if(resultCode == Activity.RESULT_OK){
// Get the File path here
// write your code for pushing the file in Sqlite
// Delete The File from gallery by using filepath
}
if (resultCode == Activity.RESULT_CANCELED) {
//Write your code if there's no result
}
}
}
答
,如果你从你的应用程序打开相机,你可以做其他的应用程序,但用户打开摄像头或默认的摄像头应用程序,你不能做到这
只是不执行任何这里
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_FILE_CAPTURE:
break;
default:
break;
}
}
不要使用内置摄像头应用程序,然后你的形象将不会存储在库 –
然后我需要在我的应用程序中创建一个可插入的自定义相机并访问它。它是正确的? @AbhishekSingh Singh –
可以使用表面视图或者在'onActivityResult(int request,int result,Intent date)中删除捕获的图像来创建自定义摄像头{}' – Eswar