Android Question adding adview to a panel (firebase admob)

tufanv

Expert
Licensed User
Longtime User
Hello
After i intialize the adview i want to add it to a panel but i get this :

B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 80 (Main)
java.lang.NullPointerException
    at anywheresoftware.b4a.objects.ViewWrapper.getWidth(ViewWrapper.java:140)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at ct.kredi.main.afterFirstLayout(main.java:102)
    at ct.kredi.main.access$000(main.java:17)
    at ct.kredi.main$WaitForLayout.run(main.java:80)
    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:5001)
    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:785)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **

what am i missing ? It normally works like this.
 

tufanv

Expert
Licensed User
Longtime User
I found the problem. for the width i was using adview1.width as in b4i . that was the problem
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…