Android Question Change AMButton text at runtime

PoppaBart

Member
I am trying to change the text of an AMButton at runtime, using buttonname.mbase.text = "Some Text"

I do not get any errors in the editor, however when I run the app I get the following error.
Error:
b4xmainpage_buildbuttons (java line: 392)
java.lang.RuntimeException: Type does not match (class anywheresoftware.b4a.BALayout)
    at anywheresoftware.b4a.objects.B4XViewWrapper.typeDoesNotMatch(B4XViewWrapper.java:405)
    at anywheresoftware.b4a.objects.B4XViewWrapper.asLabelWrapper(B4XViewWrapper.java:215)
    at anywheresoftware.b4a.objects.B4XViewWrapper.setText(B4XViewWrapper.java:229)
    at ajbsoft.medicineusage.b4xmainpage._buildbuttons(b4xmainpage.java:392)
    at ajbsoft.medicineusage.b4xmainpage._b4xpage_created(b4xmainpage.java:262)
    at ajbsoft.medicineusage.b4xmainpage.callSub(b4xmainpage.java:1023)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1098)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1069)
    at ajbsoft.medicineusage.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:532)
    at ajbsoft.medicineusage.b4xpagesmanager._showpage(b4xpagesmanager.java:869)
    at ajbsoft.medicineusage.b4xpagesmanager._addpage(b4xpagesmanager.java:203)
    at ajbsoft.medicineusage.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:210)
    at ajbsoft.medicineusage.b4xpagesmanager._initialize(b4xpagesmanager.java:720)
    at ajbsoft.medicineusage.main._activity_create(main.java:371)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
    at ajbsoft.medicineusage.main.afterFirstLayout(main.java:105)
    at ajbsoft.medicineusage.main.access$000(main.java:17)
    at ajbsoft.medicineusage.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:264)
    at android.app.ActivityThread.main(ActivityThread.java:8312)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…