Can I force my application to launch the default Camera rather than offering the 'Complete action using' list?

前端 未结 5 614
一个人的身影
一个人的身影 2021-01-05 23:29

I\'m using the intent new Intent(MediaStore.ACTION_IMAGE_CAPTURE); to capture an image for use in my application. I have two applications installed on my de

5条回答
  •  执念已碎
    2021-01-05 23:48

    the default camera app is the first app was installed. So, the first element in camlist is the default app

        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        PackageManager packageManager = MapsActivity.this.getPackageManager();
        List listCam = packageManager.queryIntentActivities(intent, 0);
        intent.setPackage(listCam.get(0).activityInfo.packageName);
        startActivityForResult(intent,INTENT_REQUESTCODE1);
    

提交回复
热议问题