use of org.microemu.cldc.file.FileSystemFileConnection in project J2ME-Loader by nikita36078.
the class MIDlet method platformRequest.
public boolean platformRequest(String url) throws ConnectionNotFoundException {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
if (url.startsWith("file://")) {
FileSystemFileConnection fileConnection = (FileSystemFileConnection) Connector.open(url);
intent.setData(fileConnection.getURI());
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
fileConnection.close();
} else {
intent.setData(Uri.parse(url));
}
ContextHolder.getActivity().startActivity(intent);
} catch (ActivityNotFoundException | IOException e) {
throw new ConnectionNotFoundException();
}
return true;
}
Aggregations