Android Question query with OutOfMemoryError

Douglas Farias

Expert
Licensed User
Longtime User
Hi all, m trying to find a solution for my problem but i really dont know what make now

ok, i need make a query to get 100 movies on my db, with image, description, title etc.
i m using customlistview for add the movies on the screen

when i need check for new movies i made clv.clear
and to download images i m using
picasso1.LoadUrl(capa_img).SkipCache.IntoImageView(capa)
with imagedownloader i have same problem, but for now i m using picasso

ok

java.lang.OutOfMemoryError

what can i make for dont have outoffmemory? i really dont see any erro on this result o_O
i have clear the customlistview all time when i make a query



B4X:
        Case "verificaupdates"
        simcategoria = False
        painelseries.visible = False
        painelsobre.Visible = False
        listacategorias.Visible = False
        Dim parser As JSONParser
        clv.Clear
        parser.Initialize(Job.GetString)
        Dim root As List = parser.NextArray
        For Each colroot As Map In root
        Dim capa_img As String = colroot.Get("capa_img")
        Dim id As String = colroot.Get("id")
        Dim titulo As String = colroot.Get("titulo")
        Dim descricaocurta As String = colroot.Get("descricaocurta")
        Dim pa As Panel
        pa.Initialize("")
        clv.Add(pa, 65%y, id)
        pa.LoadLayout("ListItem")
        lbtitulo.Typeface = fonte
        lbdescricao.Typeface = fonte
        lbtitulo.Text = titulo
        lbdescricao.Text = descricaocurta
        picasso1.LoadUrl(capa_img).SkipCache.IntoImageView(capa)
        Next
        myProgressDialog.Hide
        End Select
        Else
        myProgressDialog.Hide
        ToastMessageShow("Erro de conexão!", True)
        End If
        Job.Release


here is the full log

LogCat connected to: B4A-Bridge: motorola XT1033-359321054369100
--------- beginning of /dev/log/main
java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:836)
at android.graphics.Bitmap.createBitmap(Bitmap.java:813)
at android.graphics.Bitmap.createBitmap(Bitmap.java:780)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:76)
at njdude.custom.progressdialog.customprogressdialog._initialize(customprogressdialog.java:355)
at filmes.hd.df.main._b1_click(main.java:685)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:163)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:66)
at android.view.View.performClick(View.java:4456)
at android.view.View$PerformClick.run(View.java:18465)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:filmes.hd.df
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Service (imagedownloader) Create **
** Service (imagedownloader) Start **
java.lang.OutOfMemoryError
at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:114)
at java.lang.StringBuilder.append(StringBuilder.java:249)
at anywheresoftware.b4a.objects.streams.File$TextReaderWrapper.ReadAll(File.java:590)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring2(httpjob.java:159)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring(httpjob.java:144)
at filmes.hd.df.main._jobdone(main.java:1832)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:952)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:filmes.hd.df
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Service (imagedownloader) Create **
** Service (imagedownloader) Start **
java.lang.OutOfMemoryError
at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:114)
at java.lang.StringBuilder.append(StringBuilder.java:249)
at anywheresoftware.b4a.objects.streams.File$TextReaderWrapper.ReadAll(File.java:590)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring2(httpjob.java:159)
at anywheresoftware.b4a.samples.httputils2.httpjob._getstring(httpjob.java:144)
at filmes.hd.df.main._jobdone(main.java:1832)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:952)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)


here is the result with imagedownloader, same error
B4X:
        Case "verificaupdates"
        simcategoria = False
        painelseries.visible = False
        painelsobre.Visible = False
        listacategorias.Visible = False
        Dim parser As JSONParser
        Dim M As Map
        M.Initialize
        M.Clear
        clv.Clear
        CallSub(ImageDownloader, "ClearCache")
        parser.Initialize(Job.GetString)
        Dim root As List = parser.NextArray
        For Each colroot As Map In root
        Dim capa_img As String = colroot.Get("capa_img")
        Dim id As String = colroot.Get("id")
        Dim titulo As String = colroot.Get("titulo")
        Dim descricaocurta As String = colroot.Get("descricaocurta")
        Dim pa As Panel
        pa.Initialize("")
        clv.Add(pa, 65%y, id)
        pa.LoadLayout("ListItem")
        lbtitulo.Typeface = fonte
        lbdescricao.Typeface = fonte
        lbtitulo.Text = titulo
        lbdescricao.Text = descricaocurta
        M.Put(capa, capa_img)
        Next
        CallSubDelayed2(ImageDownloader, "Download", M)
        myProgressDialog.Hide
 
Last edited:
Top