Hi everyone,
I'm using the latest version of B4XDrawer in my project. And I'm using a custom font for my application.
It is compiling without any error. But when the app runs on the device I'm getting this error:
This is how I've included the custom font:
Error occurred on line: 228 (B4XDrawer)
How can I solve this error?
I'm using the latest version of B4XDrawer in my project. And I'm using a custom font for my application.
It is compiling without any error. But when the app runs on the device I'm getting this error:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.DynamicBuilder.build(DynamicBuilder.java:21)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:349)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:454)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:279)
at in.quest.main.main$ResumableSub_Activity_Create.resume(main.java:463)
at in.quest.main.main._activity_create(main.java:430)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:733)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:355)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at in.quest.main.main.afterFirstLayout(main.java:104)
at in.quest.main.main.access$000(main.java:17)
at in.quest.main.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at anywheresoftware.b4a.objects.ViewWrapper.buildNativeView(ViewWrapper.java:572)
at anywheresoftware.b4a.objects.CustomViewWrapper.build(CustomViewWrapper.java:93)
... 25 more
Caused by: java.lang.NumberFormatException: For input string: "res/font/hindsiliguri_light.ttf"
at java.lang.Integer.parseInt(Integer.java:615)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:133)
at android.content.res.TypedArray.getInt(TypedArray.java:386)
at android.widget.TextView.readTextAppearance(TextView.java:3561)
at android.widget.TextView.<init>(TextView.java:930)
at android.widget.TextView.<init>(TextView.java:875)
at android.widget.TextView.<init>(TextView.java:871)
at android.widget.TextView.<init>(TextView.java:867)
... 29 more
Error occurred on line: 228 (B4XDrawer)
java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:279)
at in.quest.main.main$ResumableSub_Activity_Create.resume(main.java:463)
at in.quest.main.main._activity_create(main.java:430)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:733)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:355)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at in.quest.main.main.afterFirstLayout(main.java:104)
at in.quest.main.main.access$000(main.java:17)
at in.quest.main.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:436)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:454)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
... 20 more
** Activity (main) Resume **
This is how I've included the custom font:
B4X:
CreateResource(font, hindsiliguri.xml,
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/hindsiliguri_light" />
<font
android:fontStyle="italic"
android:fontWeight="400"
android:font="@font/hindsiliguri_light" />
</font-family>
)
CreateResource(values, theme.xml,
<resources>
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:typeface">@font/hindsiliguri_light</item>
</style>
</resources>
)
Error occurred on line: 228 (B4XDrawer)
B4X:
Public Sub getCenterPanel As B4XView
Return mCenterPanel
End Sub
How can I solve this error?