-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilepicker.cpp
More file actions
33 lines (27 loc) · 1.12 KB
/
filepicker.cpp
File metadata and controls
33 lines (27 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "filepicker.h"
#include "backend.h"
#include <QtAndroid>
#include <QAndroidJniObject>
#include <QDebug>
FilePicker::FilePicker(){
}
void FilePicker::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data)
{
qDebug() << "Started";
const int REQUEST_CODE = 42;
const int RESULT_OK = -1;
if (receiverRequestCode == REQUEST_CODE && resultCode == RESULT_OK) {
QAndroidJniObject imageUri = data.callObjectMethod(
"getData",
"()Landroid/net/Uri;");
QAndroidJniObject imageFile = QAndroidJniObject::callStaticObjectMethod(
"com/example/getimage/fetch/FetchClass",
"getFilePath",
"(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;",
QtAndroid::androidActivity().object<jobject>(),
imageUri.object<jobject>());
qDebug() << "Check FilePicker class, handleActivityResult function";
qDebug() << imageFile.toString();
parent->ImageCopied(imageFile.toString());
}
}