ion = new IOnActivityResult() {
@Override
public void ResultArrived(int resultCode, Intent intent) {
String Dir = null, File = null;
if (resultCode == Activity.RESULT_OK && intent != null && intent.getData() != null) {
try {
Uri uri = intent.getData();
String scheme = uri.getScheme();
if (ContentResolver.SCHEME_FILE.equals(scheme)) {
Dir = "";
File = uri.getPath();
}
else if (ContentResolver.SCHEME_CONTENT.equals(scheme)) {
Dir = anywheresoftware.b4a.objects.streams.File.ContentDir;
File = uri.toString();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
ion = null;
if (Dir != null && File != null) {
ba.raiseEvent(ContentChooser.this, eventName + "_result", true, Dir, File);
}
else {
ba.raiseEvent(ContentChooser.this, eventName + "_result", false, "", "");
}
}
};