How to access android activity(dialog..) by using qt5.2?
-
Hello!
I want to pass a filename from qt5.2 to android, and then display a android dialog.
This means that Camera capture file of Qt5 will be display thru any algorithm on android dialog.
but not called android activity dialog..
Can anyone edit below a part of code? Help~@
(qt5.2 code)void Camera::imageSaved(int id, const QString &fileName) { int d, t; Q_UNUSED(id); Q_UNUSED(fileName); d = dateString.toInt(); qDebug() << "Date=" << d; t = timeString.toInt(); qDebug() << "Time=" << t; jint ret = QAndroidJniObject::callStaticMethod<jint>("org/qtproject/example/shfguard/QtCamera", "sendDate", "(I)I", d); ret = QAndroidJniObject::callStaticMethod<jint>("org/qtproject/example/shfguard/QtCamera", "sendTime", "(I)I", t); }
(Android-4.2.2)
(QtCamera.java)public class QtCamera extends org.qtproject.qt5.android.bindings.QtActivity { ........... public static int sendTime(int t) { String s = String.format("%d", t); EnrollFilename += s; EnrollFilename += ".jpg"; System.out.println(EnrollFilename); enrollment(); return 1; } public static int enrollment() { Context c = null; Intent intent = new Intent(new QtCamera(), InitActivity.class);//not-static value...error part! intent.putExtra("filename", EnrollFilename); c.startActivity(intent);//not-static value...error part! System.out.println("enrollment:"); return 1; } }
(InitActivity.java)
public class InitActivity extends ListActivity { .............. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); System.out.println("InitActivity:"); ............... Intent intent = getIntent(); //Bundle extras = getIntent().getExtras(); EnrollFilename = intent.getStringExtra("filename"); .............. }
(AndroidManifest.xml)
........... </activity> <activity android:name=".QtCamera" android:label="QtCamera"/> <activity android:name=".InitActivity" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation"/> </application> ...........
@
-
Hi,
bq. This means that Camera capture file of Qt5 will be display thru any algorithm on android dialog.
Do you mean you want to use Android Intents ?
-
Thank you for reply.
First of all, I want to display a dialog of InitActivity's setContentView(R.layout.activity_main)..
but , I can't access it. -
Hi,
Sorry but i have never called a Custom Class using Intents. But i have managed to call Standard Activity Actions.
Have you made sure that the QtCamera class gets using callStaticMethod ?