Android Question Unable to find resource ID #0x1a

schimanski

Well-Known Member
Licensed User
Longtime User
Did someone knows the following exception? It is raised after changing the screen orientation, but the hole app hangs up, so i can't find the errorline in debug mode....

B4X:
android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1a
    at android.content.res.Resources.getResourceName(Resources.java:3023)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:882)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    at android.app.BackStackRecord.run(BackStackRecord.java:684)
    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1453)
    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    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:5586)
    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:1268)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
    at dalvik.system.NativeStart.main(Native Method)
 

schimanski

Well-Known Member
Licensed User
Longtime User
It happens everytime, when I change the screen orientation. But with the info, that it is related to GoogleMaps, I could perhaps find the reason...I will ty something more...thank you..
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
You could try looking in your project's Objects folder after you have compiled.
Look in the src folder for the compiled java R class.

Now try to find the R class member that has the value #0x1a - if you can find it then the member name should help you work out which resource cannot be found.
 
Upvote 0

pierrem

Member
Licensed User
Longtime User
Hi,

same error ....

In the project\src folder, only anywhersoftware folder (with some subfolder ... with no 'compiled java'

Where is my mistake ?

(and merry XMas !)
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
I made some more tests. The problem is the fourth tab of the stdactionbar.
When I have only three tabs, no problem. The fourth raises the exception with sometimes different resources.

B4X:
Sub Globals
   Dim bar As StdActionBar
   Private vp As StdViewPager
   Private panelPfeil, panelKarte, panelZiel As Panel
   Private panelTest As Panel
..
..
end sub

Sub Init_Grafik
    panelPfeil.Initialize("")
    panelKarte.Initialize("")
    panelZiel.Initialize("")
    panelTest.Initialize("")

    Dim height As Int = CalculateHeight(True, False)
    vp.Initialize("vp",4 , 100%x, height)
    Activity.AddView(vp.AsView, 0, 0, 100%x, height)
    If Activity.Width<Activity.height Then
        vp.Panels(0).addView(panelPfeil, 0,0,100%x, 100%y-50dip)
        vp.Panels(1).AddView(panelKarte, 0,0,100%x, 100%y-50dip)
        vp.Panels(2).AddView(panelZiel, 0,0,100%x, 100%y-50dip)
        vp.Panels(3).AddView(panelTest, 0,0,100%x, 100%y-50dip)
    Else
        vp.Panels(0).addView(panelPfeil, 0,0,100%x, 100%y)
        vp.Panels(1).AddView(panelKarte, 0,0,100%x, 100%y)
        vp.Panels(2).AddView(panelZiel, 0,0,100%x, 100%y)
        vp.Panels(3).AddView(panelTest, 0,0,100%x, 100%y)
    End If
    bar.Initialize("bar")
    Activity.Title = "Test"
    bar.Subtitle = "Version " & Versionsinfo
    bar.Icon = IconBitmap
    bar.NavigationMode = bar.NAVIGATION_MODE_TABS
    bar.AddTab("Pfeil")
    bar.AddTab("Karte")
    bar.AddTab("Ziel")
    bar.AddTab("Test")
    bar.ShowUpIndicator =False
    bar.SelectedIndex = currentPage
End Sub

B4X:
    android.content.res.Resources$NotFoundException: Unable to find resource ID #0x19
    at android.content.res.Resources.getResourceName(Resources.java:3023)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:882)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    at android.app.BackStackRecord.run(BackStackRecord.java:684)
    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1453)
    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    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:5586)
    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:1268)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
    at dalvik.system.NativeStart.main(Native Method)
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
Good catch.

Add these two lines after you initialize ViewPager:

B4X:
vp.Initialize("vp", 10, 100%x, h)Dim jo As JavaObject = vp
jo = jo.GetFieldJO("vp").RunMethod("setOffscreenPageLimit", ArrayAsObject(100)) 'the first string is "vp" (not related to the variable)

Problem solved!!!
Much thanks....
 
Upvote 0
Top