Java Question android.content.res.Resources$NotFoundException: Resource ID #0x7f0b001c

laomms

Member
Licensed User
Longtime User
I got the following crash report when use a wrappered library , but I can't work out what might of caused it. any help or hint? thanks!

B4X:
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example/top.nicelee.purehost.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f0b001c

the wrapper code:
B4X:
@Version(1.0f)
@Permissions(values={"android.permission.INTERNET"})
@ShortName("PureHostLib")
@ActivityObject
public class B4AWrapperClass extends AbsObjectWrapper<MainActivity> {

    @Hide
    public static BA ba;
    @Hide
    public static String eventName;
    private static MainActivity cv;
    private IOnActivityResult ion;
    Intent intent;
    Context context;
 
    public void Initialize(BA paramBA, String paramString) {
        eventName = paramString.toLowerCase(BA.cul);
        BA.Log("eventName:" +eventName );
        ba = paramBA;
        MainActivity cv = new MainActivity();
        String str = paramString.toLowerCase(BA.cul);
        BA.Log("str:" +str );
        setObject(cv);
        intent = new Intent(BA.applicationContext, MainActivity.class);
        BA.Log("intent:" +intent );
        int layoutId = BA.applicationContext.getResources().getIdentifier("activity_main", "layout", BA.packageName);
        BA.Log("layoutId_activity_main:" +Bit.ToHexString(layoutId) );
        int resourceId = BA.applicationContext.getResources().getIdentifier("activity_main", "id", BA.packageName);
        BA.Log("resourceId_activity_main:" +Bit.ToHexString(resourceId) );
    }

    public Intent GetIntent()
    {    
        return intent;
    }
 
    public void setContentView(BA pBA, String LayoutName){
        pBA.activity.setContentView(BA.applicationContext.getResources().getIdentifier(LayoutName, "layout", BA.packageName));
    }
}



pic.png
 

Attachments

  • PureHost_SLC_src.zip
    47.6 KB · Views: 273
  • WrapperTest.zip
    21.4 KB · Views: 291
Last edited:

laomms

Member
Licensed User
Longtime User
Last edited:

laomms

Member
Licensed User
Longtime User
this is finished sample project and lib.

the source I have post in my github:

here is some wrapper video for this lib that I post in youtube:

gif.gif
 

Attachments

  • WrapperTest.zip
    22.4 KB · Views: 330
  • PureHostLib.zip
    42.2 KB · Views: 302
Last edited:
Top