Johnmcenroy Active Member Licensed User Longtime User Jun 1, 2013 #1 I use the following function in my JAVA Library: B4X: public void setContentView(BA pBA, String LayoutName){ pBA.activity.setContentView(BA.applicationContext.getResources().getIdentifier(LayoutName, "layout", BA.packageName)); } I have a layout in res/layout - layout.main.xml So I compile my library and load in B4A In B4A I type: B4X: Test.setContentView("layout.main.xml") But I recieve in logs the following: android.content.res.Resources$NotFoundException: Resource ID #0x0 Why ? Thanks
I use the following function in my JAVA Library: B4X: public void setContentView(BA pBA, String LayoutName){ pBA.activity.setContentView(BA.applicationContext.getResources().getIdentifier(LayoutName, "layout", BA.packageName)); } I have a layout in res/layout - layout.main.xml So I compile my library and load in B4A In B4A I type: B4X: Test.setContentView("layout.main.xml") But I recieve in logs the following: android.content.res.Resources$NotFoundException: Resource ID #0x0 Why ? Thanks
warwound Expert Licensed User Longtime User Jun 2, 2013 #2 Remove .xml from the layout name. Martin. Sent from my GT-I9300 using Tapatalk 2