public static String readTextFileFromUrl(String url) throws IOException {
try(InputStream is = FileSystemStorage.getInstance().openInputStream(url);) {
InputStreamReader br = new InputStreamReader(is);
int numChars=is.available();
char[] b=new char[numChars];
br.read(b, 0,numChars);
br.close();
return new String(b);
} catch(IOException err) {
String error=err.getMessage();
System.out.println("write exc "+error);
}
return null;
}
String arg=Display.getInstance().getProperty("AppArg",null);
gives the exception, then yields null.
Regards
It is a very simple case because just that instruction has to be put in the start() method of any test app with
codename1.arg.android.xintent_filter=<intent-filter><action android\:name\="android.intent.action.SEND" /><action android\:name\="android.intent.action.VIEW" /><action android\:name\="android.intent.action.PICK" /><category android\:name\="android.intent.category.DEFAULT" /><category android\:name\="android.intent.category.BROWSABLE" /><category android\:name\="android.intent.category.OPENABLE" /><data android\:scheme\="file" /><data android\:scheme\="content" /><data android\:mimeType\="*/*" /></intent-filter>
public void start() {
String arg=Display.getInstance().getProperty("AppArg",null);
System.out.println("arg="+arg);
if(current != null){
current.show();
return;
}
...
...
I sent the Android build, I do not think it is safe to attach the apk here. You can easily do the same.
Then put a file into the Download folder and open it with some file-manager app.
Regards