我是Qt应用程序开发的新手。我想打开相机并拍照,并使用QtAndroid和JNIObject获取图像路径。
例如,
Intent capture_image_intent = new Intent();
capture_image_intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(capture_image_intent, 101);我想用Qandroidjniobject在我的Qt应用程序中启动摄像头。所以,请帮我用qt写一个代码。
发布于 2020-06-25 07:33:46
我使用Qandroidjniobject在Qt中解决了上述问题。
下面给出了使用意图代码发射相机的步骤,
QAndroidJniObject ACTION_IMAGE_CAPTURE =
QAndroidJniObject::getStaticObjectField("android/provider/MediaStore",
"ACTION_IMAGE_CAPTURE", "Ljava/lang/String;");
QAndroidJniObject intent("android/content/Intent", "(Ljava/lang/String;)V",
ACTION_IMAGE_CAPTURE.object<jstring>());
QtAndroid::startActivity(intent.object<jobject>(), 101, this);https://stackoverflow.com/questions/62557318
复制相似问题