用QAndroidJniObject来做new一个对象:
java |
Qt C++ |
File file = new File(); |
QAndroidJniObject file(“java/io/File”, “()V”); |
File file = new File(“/tmp/a.txt”); |
QAndroidJniObject str = QAndroidJniObject::fromString(“/tmp/a.txt”); QAndroidJniObject file(“java/io/File”, “(Ljava/lang/String;)V”, str.object()); |
intent.putExtra(MediaStore.EXTRA_OUTPUT, takePhotoSavedUri); |
intent.callObjectMethod(“putExtra”,”(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;”, MediaStore__EXTRA_OUTPUT.object(), takePhotoSavedUri.object()); |
boolean |
Z |
byte |
B |
char |
C |
short |
S |
int |
I |
long |
J |
float |
F |
double |
D |
完整类名 |
L完整类名/分隔; |
类型[] |
[类型 |
函数类型 |
(多个参数类型)返回类型 |
代码转换例子
String action = "android.media.action.IMAGE_CAPTURE";
Intent intent = new Intent(action);
File extDir = Environment.getExternalStorageDirectory();
String filename = "camera.jpg";
File photo = new File(extDir, filename);
Uri takePhotoSavedUri = Ur