From what I have read: Multiple Mimes are allowed so I wanted to add the following routine to Phone Library / Content Chooser
I just do not know how to go about compiling the Phone Library.
Added this routine into the Content Chooser section and then tried to compile with simple library compiler but got a ton of errors so I'm thinking that I'm doing something wrong??
ShowMultipleMIME:
public void ShowMultipleMIME(final BA ba, String[] MimeTypes, String Title) {
if (eventName == null)
throw new RuntimeException("ContentChooser not initialized.");
Intent in = new Intent(Intent.ACTION_GET_CONTENT);
in.setType("*/*");
in.putExtra(Intent.EXTRA_MIME_TYPES, MimeTypes);
in.addCategory(Intent.CATEGORY_OPENABLE);
in = Intent.createChooser(in, Title);
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, "", "");
}
}
};
ba.startActivityForResult(ion, in);
}
I just do not know how to go about compiling the Phone Library.
Added this routine into the Content Chooser section and then tried to compile with simple library compiler but got a ton of errors so I'm thinking that I'm doing something wrong??
Attachments
Last edited: