Sorry for late reply Steve..
here is the full stack trace
Resource not found:
file:///data/data/com.mypackage.myapp/files/MyFileName.pdf
java.io.IOException:
file:///data/data/com.mypackage.myapp/files/MyFileName.pdf not found
at com.codename1.ui.util.Resources.open(Resources.java:740)
at com.codename1.ui.util.Resources.open(Resources.java:679)
at
com.mypackage.myapp.MyFileNameForm$1.actionPerformed(MyFileNameForm.java:158)
at
com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:349)
at com.codename1.ui.Button.fireActionEvent(Button.java:499)
at com.codename1.ui.Button.released(Button.java:533)
at com.codename1.ui.Button.pointerReleased(Button.java:637)
at com.codename1.ui.Form.pointerReleased(Form.java:2980)
at com.codename1.ui.Component.pointerReleased(Component.java:4100)
at com.codename1.ui.Display.handleEvent(Display.java:2061)
at com.codename1.ui.Display.edtLoopImpl(Display.java:1043)
at com.codename1.ui.Display.mainEDTLoop(Display.java:961)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:841)
and i forgot to mention that , while trying to open file using below code
getting this exception..
try {
Resources.open(fs.getAppHomePath() + "MyFileName.pdf");
} catch (IOException e) {
e.printStackTrace();
}
but still don't know it is saving or not..
On Tuesday, February 13, 2018 at 6:04:12 PM UTC+5:30, Steve Hannah wrote:
>
> It is very strange that the IOException is reporting the path with the
> file:/// prefix. This should have been stripped by the time it gets
> there. Can you post a full stack trace?
>
> On Tue, Feb 13, 2018 at 1:09 AM, <[email protected] <javascript:>>
> wrote:
>
>> Thanks shai for reply.. I have tried "fs.mkdir(fs.getAppHomePath());"
>> like below but still i'm getting
>>
>>> java.io.IOException:
>>> file:///data/data/com.engravsystems.emqim/files//MyFileName.pdf not found ..
>>>
>>
>> here is the code :
>>
>> FileSystemStorage fs = FileSystemStorage.getInstance();
>>
>> try {
>>
>> if(!fs.exists(fs.getAppHomePath()))
>> fs.mkdir(fs.getAppHomePath());
>>
>> OutputStream os =
>> fs.openOutputStream(fs.getAppHomePath() + "MyFileName.pdf");
>>
>> os.write(hrFiles.get(finalI).get("fileData").toString().getBytes());
>> Util.cleanup(os);
>> } catch (IOException e) {
>> e.printStackTrace();
>> }
>>
>>
>>
>>
>> On Tuesday, February 13, 2018 at 10:45:10 AM UTC+5:30, Shai Almog wrote:
>>>
>>> I think your code is correct. I think that app home might not exist
>>> which seems to me like an omission on our part.
>>> Try
>>>
>>> fs.mkdir(fs.getAppHomePath());
>>>
>>> --
>> 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]
>> <javascript:>.
>> Visit this group at
>> https://groups.google.com/group/codenameone-discussions.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/codenameone-discussions/546eb817-a1d9-486b-a507-28d94a4a1f86%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/codenameone-discussions/546eb817-a1d9-486b-a507-28d94a4a1f86%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Steve Hannah
> Software Developer
> Codename One
> http://www.codenameone.com
>
--
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].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/64393a3b-a82e-47ab-92bd-00726ecd7e9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.