The following method is called:

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;

}

Il giorno domenica 7 febbraio 2021 alle 03:14:46 UTC+1 Shai Almog ha 
scritto:

> Share intent on Android doesn't provide download folder access. It gives 
> you a local URL to give you access to the file on your app without giving 
> you access to all the downloaded files within the folder. So the URL should 
> be fine. Not sure why it won't open though, How did you open that file?
>
> On Saturday, February 6, 2021 at 3:04:15 PM UTC+2 P5music wrote:
>
>> I am trying to check my CodenameOne app on Android device.
>> The file read/write permission seems to have some problems. The user is 
>> asked about it at installation, but it does not seem to become effective 
>> for the app (some basic files are not saved on filesystem, exception is 
>> thrown)
>>
>> I know that my app is not developed to handle file write on Android 
>> device. I do not mind.
>>
>> But
>> I am testing the file opening from the filesystem (AppArg).
>>
>> When the user selects a file with .ext extension  (alias for the file 
>> type handled by the app)
>> from the Download folder
>>  I see in logcat:
>>
>> System.err: java.io.FileNotFoundException: 
>> file:/data/user/0/com.myapp.app/files/myfile.ext: open failed: ENOENT (No 
>> such file or directory)
>>
>> (and the app seems blocked, two "activity" screens are in the "recent 
>> apps")
>>
>> It is strange because it does not seem that the url path is from the 
>> Download folder.
>> The app is trying to open the url from AppArg.
>>
>> What's wrong?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/dd4f2e29-e329-4357-b86f-afee9745987an%40googlegroups.com.

Reply via email to