I don't know how B4A works but I finished some code I was writing only to end up with an exception error. The error it is listing is on the destination file and it says file not found. It's not there because I am trying to copy it. The log file is below and you can see the External SDcard is writable. You can also see the variables I am using SDir, SFile, DDir, DFile and the values in each. These directories are there and I can set an imageview to an image in each of these paths and the image displays with no problem, even the image I am trying to copy. It's almost like the File.Copy is trying to work backwards because of the FileNotFoundException being connected to the destination. Any ideas whats going on? The first block is the code and the second the log file.
Thanks,
Margret
Code:
Log File:
Thanks,
Margret
Code:
B4X:
Log("SDir: " & SDir)
Log("SFile: " & SFile)
Log("DDir: " & DDir)
Log("DFile: " & DFile)
Log("File.ExternalWritable: " & File.ExternalWritable)
File.Copy(SDir, SFile, DDir, DFile)
Log File:
B4X:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
SDir: /mnt/media/My Files/Pictures
SFile: davidwsp.jpg
DDir: /mnt/sdcard/My Files/Pictures
DFile: davidwsp.jpg
File.ExternalWritable: true
main_btnsfok_click (B4A line: 36)
File.Copy(SDir, SFile, DDir, DFile)
java.io.FileNotFoundException: /mnt/sdcard/My Files/Pictures/davidwsp.jpg (Permission denied)
at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:344)
at anywheresoftware.b4a.objects.streams.File.Copy(File.java:320)
at ADR.file.main._btnsfok_click(main.java:288)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:104)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:92)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:88)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:49)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8818)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
java.io.FileNotFoundException: /mnt/sdcard/My Files/Pictures/davidwsp.jpg (Permission denied)