Hello folks, Hoping someone can help me with this..
Everytime I attempt to copy files from assets to the external storage on this first generation Motorola droid, I get the following Error:
An error occurred in sub db_copyfromassets(java line: 82)
java.io.exception
continue?
I have verified that there is 1.86GB free on the SD Card... It is writing other files to the defdirexternal, but errors when attempting to put into the subdir. I see no permission denied errors, so am stumped.
the code i am using is as follows:
I am calling the routine with this:
my Tracelog is as follows:
I am running this code on 3 different versions of LG, y HTC without difficulties
Problem Phone:
Running: v.2.2.3, build frk76
Thanks in advance!
...Pablo
Everytime I attempt to copy files from assets to the external storage on this first generation Motorola droid, I get the following Error:
An error occurred in sub db_copyfromassets(java line: 82)
java.io.exception
continue?
I have verified that there is 1.86GB free on the SD Card... It is writing other files to the defdirexternal, but errors when attempting to put into the subdir. I see no permission denied errors, so am stumped.
the code i am using is as follows:
B4X:
'Excerpt from My Class RES
Sub CopyDBFromAssets (FileName As String,SubDir As String, ForceCopy As Boolean) As String
Dim TargetDir As String
'Log("Checking where we can write to...")
If File.ExternalWritable=True Then TargetDir = File.DirDefaultExternal Else TargetDir = File.DirInternal
'Log("Writing to: " & TargetDir)
'Check to See if Directory Exists...If Not Create it
'Log("Checking to see if directory exists")
If File.IsDirectory(TargetDir & "/" & SubDir,"test")=False Then
File.MakeDir(TargetDir,SubDir)
'Log("Created directory...")
Else
'Log("Directory existed!")
End If
TargetDir=TargetDir & "/" & SubDir
If File.Exists(TargetDir, FileName) = False OR ForceCopy=True Then
File.Copy(File.DirAssets, FileName, TargetDir, FileName)
End If
Return TargetDir
End Sub
I am calling the routine with this:
B4X:
'Activity SysLoader
Sub Globals
dim res as RES 'My Class
dim tBiblePath as String
end Sub
Sub Activity_Create(FirstTime As Boolean)
tBiblePath="bibles"
EBSystem.BiblePath=res.CopyDBFromAssets("amp_bible.db",tBiblePath,True)
End Sub
my Tracelog is as follows:
I am running this code on 3 different versions of LG, y HTC without difficulties
B4X:
PackageAdded: package:biblia.electronica
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (ebsystem) Create **
** Service (ebsystem) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (sysloader) Create, isFirst = true **
db_copydbfromassets (java line: 82)
java.io.IOException
at android.content.res.AssetManager.readAsset(Native Method)
at android.content.res.AssetManager.access$700(AssetManager.java:36)
at android.content.res.AssetManager$AssetInputStream.read(AssetManager.java:571)
at anywheresoftware.b4a.objects.streams.File.Copy2(File.java:336)
at anywheresoftware.b4a.objects.streams.File.Copy(File.java:325)
at biblia.electronica.db._copydbfromassets(db.java:82)
at biblia.electronica.sysloader._activity_create(sysloader.java:260)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at biblia.electronica.sysloader.afterFirstLayout(sysloader.java:84)
at biblia.electronica.sysloader.access$100(sysloader.java:16)
at biblia.electronica.sysloader$WaitForLayout.run(sysloader.java:72)
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.IOException
Problem Phone:
Running: v.2.2.3, build frk76
Thanks in advance!
...Pablo