Android Tutorial ActionBar / Sliding Pages tutorial

samikinikar

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

Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
Timeline: Activity_idle id: android.os.BinderProxy@26506abd time:102233599
Timeline: Activity_launch_request id:b4a.example time:102276689
** Activity (main) Pause, UserClosed = false **
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
22
** Activity (main) Resume **
 

samikinikar

Member
Licensed User
Longtime User
I am using 5.5 trial version, I have not changed a single line of code, directly executing the given example, the final output after running the program is as follows.

** 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)
** Activity (main) Resume **
** Activity (main) Resume **
 

u2005k

Member
Licensed User
Longtime User
Hi

Hi Roger,
I get error resource directory 'c:\androidapps\dagbokvit\slidingmenu\library\res' does not exist. Where do I get these resources?
Thanks
U2005K
 

cxdzbl

Active Member
Licensed User

At the time of using this library. Every time the software starts to go through a default interface with the software name, a flash before entering the Activity.LoadLayout ("layout"). How can we directly access the layout main
 

cxdzbl

Active Member
Licensed User
I recommend you to switch to TabStripViewPager. I tested it in release mode. The layout appears very quickly. There is a very short moment where you see an empty activity.


1, when you directly from the first page to click on the third page of the total to go through second pages, this is not as good as stdveiwpager.
2, at the start of the same time there is a short blank interface.
 

jayel

Active Member
Licensed User
Longtime User
Hey,

Sliding works.... but when I click the tabpages it doesn't change?

John
 

u2005k

Member
Licensed User
Longtime User

Is it possible to get click event on icon on standard action bar? Using ShowUpIndicator does not very well go with theme that we are using.

Thanks & regards...
U2005K
 

victormedranop

Well-Known Member
Licensed User
Longtime User
HI, in the example I have this sentence
B4X:
Activity.AddMenuItem3("", "mnuUndo", LoadBitmap(File.DirAssets, "exit.png"), True)

but I try with an event to change the image but I cant find the way to modify the menuitem when its running

thanks

Victor
 

Drago Bratko

Active Member
Licensed User
Longtime User
I have same problem as in post number #79 in this thread.
I see that in post #84 it was handled. Can you share solution ?
In my case it's broken on this line : bar.Icon = LoadBitmap(File.DirAssets, "ic_action_user.png")

B4X:
    'load the pages layouts
    vp.Panels(0).LoadLayout("ProizvodiTop")
    vp.Panels(1).LoadLayout("Postavke")
    vp.Panels(2).LoadLayout("Login")
    bar.Initialize("bar")
    bar.Icon = LoadBitmap(File.DirAssets, "ic_action_user.png")
    bar.NavigationMode = bar.NAVIGATION_MODE_TABS
    bar.AddTab("Top proizvodi")
    bar.AddTab("Proizvodi a-z")
    bar.AddTab("Račun")
    bar.ShowUpIndicator = True
    bar.SelectedIndex = currentPage

Error is :
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setIcon(android.graphics.drawable.Drawable)' on a null object reference

This is code from example copied to my project. In folder "Files" there us image "ic_action_user.png".
SDK version which I got it with : Log(p.SdkVersion) is 24.
 
Last edited:

Drago Bratko

Active Member
Licensed User
Longtime User
Erel, thank you. Great suggestion. I have switch to TabStripViewPager. Works perfectly.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…