大佬教程收集整理的这篇文章主要介绍了android – 如何在不使用相机应用程序的情况下从相机中检索图像(通过服务),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<receiver android:name=".pictureReceiver" > <intent-filter android:priority="10000" > <action android:name="com.android.camera.NEW_PICTURE"/> <data android:mimeType="image/*"/> </intent-filter> </receiver>
onReceive代码:
@Override public void onReceive(Context arg0,Intent arg1) { String SELEctedImageUri = arg1.getData().getPath(); Log.d("TAG","Received new photo:::"+SELEctedImageUri ); Log.d("TAG","file Path"+getRealPathFromURI(arg1.getData(),arg0)); } public String getRealPathFromURI(Uri contentUri,Context context) { try { String[] proj = {MediaStore.Images.Media.DATA}; cursor cursor = context.getContentResolver().query(contentUri,proj,null,null); int @R_944_8620@n_index = cursor.get@R_944_8620@nIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(@R_944_8620@n_indeX); } catch (Exception E) { return contentUri.getPath(); } }
以上是大佬教程为你收集整理的android – 如何在不使用相机应用程序的情况下从相机中检索图像(通过服务)全部内容,希望文章能够帮你解决android – 如何在不使用相机应用程序的情况下从相机中检索图像(通过服务)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。