Android Question error ...customlistview/cache/1 (No such file or directory)

pierrem

Member
Licensed User
Longtime User
Hi,

I wrote an app with 'android:targetSdkVersion="14"' in manifest.xml

that works perfectly on several devices under Android 4.4.2
but when testing with Android 4.3.6, I get the following error :
LogCat connected to: LGOTMS6c01b7
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
Error occurred on line: 265 (main)
java.io.FileNotFoundException: /data/data/anywheresoftware.b4a.samples.customlistview/cache/1 (No such file or directory)
at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
at java.io.FileInputStream.<init>(FileInputStream.java:80)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring2(httpjob.java:155)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring(httpjob.java:144)
at anywheresoftware.b4a.samples.customlistview.main._jobdone(main.java:1454)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA$3.run(BA.java:320)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3735)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:662)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Pause, UserClosed = true **

on line 256, I have :
Log("retour :"&job.GetString)

job is a post request from a web serveur and it is inJSon format
(perfectly read on the other devices ... the JSon is not the problem)


I found some related post on this forum, I clear the cache, ... no way

Any ideas ?
Thanks in advance.

(not easy to upload the project to the forum without revealing server's address and json request.
Sorry)
 

pierrem

Member
Licensed User
Longtime User
Not really optmized !
:)

Sub jobdone(job As HttpJob)
Dim Liste As List 'contiendra les données retournées par le serveur JSON
Dim map0 As Map 'contiendra ces données en paire : key -> value
Dim reponse As String 'réponse du serveur, en 1er dans le JSON
Dim json As JSONParser 'objet JSON pour traiter le retour serveur
'traitement du résultat des 20 premiers
Log("job name :"&job.Jobname)
If job.JobName== "job1" Then 'cas : réception des données du serveur web
clv3.Initialize(Me, "clv3") 'on initialise la clv qui va contenir les 20 premiers noms venant du serveur web
tab1.AddView(clv3.AsView, 0, 0, 100%x, 100%y) 'et ajout dans l'onglet qui va bien (Recherche)
json.Initialize(job.GetString) 'on récupère le JSON
Liste=json.NextArray 'on le met dans la liste
map0.Initialize 'initialisation de la map
map0=Liste.Get(0) 'on lit le 1er élément
reponse=map0.Get("reponse") 'affectation de la réponse du serveur
If reponse == "ok0" Then 'si cette réponse est 'ok0' (on est bon ...)
For cpt=1 To Liste.Size-1 'début de la boucle de remplissage de la map
Dim map1 As Map '
map1.Initialize '
map1=Liste.Get(cpt) 'affectation
clv3.Add(CreateListItem(map1, clv3.AsView.Width, 95dip), 95dip,clv3.AsView) 'ajout d'un panel pour chaque enregistrement
Next
Else
ToastMessageShow("Erreur de récupération des données",True)
End If
' traitement de la requête d'inscription
Else If job.JobName == "jobID" Then 'cas : réception de l'ID de l'utilisateur (inscription)
Log("retour :"&job.GetString)
json.Initialize(job.GetString) 'on récupère les données JSON
'Log("job.string dans jobID"&job.GetString)
Liste=json.NextArray 'on remplit la liste
Log("jobID ... retour :"&Liste)
map0.Initialize 'on initialise la map
map0=Liste.Get(0) 'on lit le 1er élément
reponse=map0.Get("reponse") 'affectation de la réponse du serveur
If reponse=="ok1" Then 'si cette réponse est ok1 (on est bon ...)
SQL1.Initialize(File.DirRootExternal, "Database.db", False)
'id INT, nom TEXT, prenom TEXT, adresse TEXT, ville TEXT, cp TEXT, mobile TEXT, mail TEXT, villeclub TEXT, numeroclub TEXT, nomregion TEXT, numeroregion TEXT, photo TEXT)
'si l'utilisateur a bien été trouvé sur le serveur web, on l'ajoute localement avec un ID = -1 (réservé utilisateur)
Dim param As String
param="(-1,'"&nom.Text&"','"&prenom.Text&"','adresse','ville','cp','"&mobile.Text&"','mail','villeclub','numeroclub','nomregion','numeroregion','photo')"
Log("param pour jobID sql :"&param)
SQL1.ExecNonQuery("insert into annuaire values "&param)
tabmanager.setTabEnabled2(TabHost1,True,0)
tabmanager.setTabEnabled2(TabHost1,True,1)
ToastMessageShow("Vous avez été identifié ...",True)
showResume
Else
ToastMessageShow("Vous n'avez pas été identifié ... vérifiez les données, et recommancez",True)
End If
Else If (job.JobName == "jSearch") Then
Dim newSearch As Button
tab1.RemoveAllViews
newSearch.Initialize("newSearch")
newSearch.Text="Nouvelle recherche"
clv3.Initialize(Me, "clv3") 'on initialise la clv qui va contenir les 20 premiers noms venant du serveur web
tab1.AddView(clv3.AsView, 0dip, 50dip, 100%x, 100%y) 'et ajout dans l'onglet qui va bien (Recherche)
tab1.AddView(newSearch,10dip,5dip,200dip,40dip)
'Log(job.GetString)
json.Initialize(job.GetString) 'on récupère le JSON
Liste=json.NextArray 'on le met dans la liste
'Log("Search :"&Liste)
map0.Initialize 'initialisation de la map
map0=Liste.Get(0) 'on lit le 1er élément
reponse=map0.Get("reponse") 'affectation de la réponse du serveur
If reponse == "ok2" Then 'si cette réponse est 'ok0' (on est bon ...)
For cpt=1 To Liste.Size-1 'début de la boucle de remplissage de la map
Dim map1 As Map '
map1.Initialize '
map1=Liste.Get(cpt) 'affectation
'Log(map1)
clv3.Add(CreateListItem(map1, clv3.AsView.Width, 95dip), 95dip,clv3.AsView) 'ajout d'un panel pour chaque enregistrement
Next
Else
ToastMessageShow("Search : Erreur de récupération des données",True)
End If
Else
ToastMessageShow("job http inconnu !"&job.JobName,True)
End If
End Sub
 
Upvote 0

pierrem

Member
Licensed User
Longtime User
You were right ... and I'm a stupid dumb : this device was not wifi connected ...
When it is, the app run normally.

1.000 thanks
 
Upvote 0
Top