Android Question Actionbar / Sliding panel error

samikinikar

Member
Licensed User
Longtime User
Hello,

I am not able to run the following actionbar.zip example located in https://www.b4x.com/android/forum/threads/actionbar-sliding-pages-tutorial.36865/

There is no change made in the code, just unzip and trying to execute.
Android 4+ is already added to the additional library resource.

I displays the following error

** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
Error occurred on line: 36 (Main)
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setIcon(android.graphics.drawable.Drawable)' on a null object reference
at anywheresoftware.b4a.objects.StdActionBar.setIcon(StdActionBar.java:227)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:742)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at b4a.example.test123.main.afterFirstLayout(main.java:102)
at b4a.example.test123.main.access$000(main.java:17)
at b4a.example.test123.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
 

samikinikar

Member
Licensed User
Longtime User
Yes it is initialized, attached is screenshot of the code.
 

Attachments

  • sliding_panel_error.jpg
    sliding_panel_error.jpg
    84.8 KB · Views: 170
Upvote 0

samikinikar

Member
Licensed User
Longtime User
Yes I am testing it on a real device
1. Device : Cynanogen (YUPHORIA) Android version 5.1.1
2. Device : Samsung Galaxy TAB4 , Android version 4.4.2

Same on both the devices.

The current error log is

Error occurred on line: 35 (Main)
java.lang.NullPointerException
at anywheresoftware.b4a.objects.StdActionBar.setIcon(StdActionBar.java:227)
at b4a.example.test123.main._activity_create(main.java:377)
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:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
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 b4a.example.test123.main.afterFirstLayout(main.java:102)
at b4a.example.test123.main.access$000(main.java:17)
at b4a.example.test123.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:5479)
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:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
 
Upvote 0

samikinikar

Member
Licensed User
Longtime User
The code is as follows...

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")
SetApplicationAttribute(android:uiOptions, "splitActionBarWhenNarrow")
 
Upvote 0

samikinikar

Member
Licensed User
Longtime User
ok now tested in MI Xiomi .. same error

** Activity (main) Create, isFirst = true **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
Error occurred on line: 35 (Main)
java.lang.NullPointerException
at anywheresoftware.b4a.objects.StdActionBar.setIcon(StdActionBar.java:227)
at b4a.example.test123.main._activity_create(main.java:377)
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:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
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 b4a.example.test123.main.afterFirstLayout(main.java:102)
at b4a.example.test123.main.access$000(main.java:17)
at b4a.example.test123.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5349)
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:835)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:651)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
** Activity (main) Resume **

** Activity (main) Resume **
** Activity (main) Resume **
PackageAdded: package:com.google.android.music
 
Upvote 0

samikinikar

Member
Licensed User
Longtime User
Ok now complete new installation right from step1 on a new desktop, new download .net version, jdk and android-sdk

Now the error is ...

*** Remote compilation mode ***
B4A version: 5.50
Parsing code. (0.00s)
Compiling code. (0.03s)
Compiling layouts code. (0.02s)
Compiling debugger engine code. (0.75s)
Sending data to remote compiler. Error
step: Compiling generated Java code.
javac 1.7.0
src\b4a\example\main.java:345: error: cannot find symbol
public anywheresoftware.b4a.objects.StdActionBar _bar = null;
^
symbol: class StdActionBar
location: package anywheresoftware.b4a.objects
1 error
 
Upvote 0

samikinikar

Member
Licensed User
Longtime User
At last, its working now...you are right ..something wrong with my configurations, on a new machine, all new downloads, everything is working fine now...
I will check out whats wrong with my laptop config... thanks a lot for all your support.
 
Upvote 0
Top