-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.java
More file actions
42 lines (28 loc) · 818 Bytes
/
MainActivity.java
File metadata and controls
42 lines (28 loc) · 818 Bytes
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
34
35
36
37
38
39
40
41
//% IMPORTS
import android.app.Activity;
import android.content.Intent;
import android.content.IntentFilter;
import fileopen.FileOpen;
//% END
//% MAIN_ACTIVITY_BODY
private static final int FILE_REQUEST_CODE = 12;
public void OpenFile() {
Intent myIntent = new Intent(Intent.ACTION_GET_CONTENT, null);
myIntent.setType("application/*");
startActivityForResult(myIntent, FILE_REQUEST_CODE);
}
//% END
//% MAIN_ACTIVITY_ON_ACTIVITY_RESULT
if (requestCode == FILE_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
Log.w("SAPP", "URI: " + data.getData());
FileOpen.OnDataReceived(this, data.getData());
} else {
FileOpen.OnDataReceived(this, null);
}
}
//% END
//% MAIN_ACTIVITY_ON_CREATE
FileOpen.MainActivity = this;
FileOpen.FileOpenInit();
//% END