B4A Library [Class] ActionBar

incendio

Well-Known Member
Licensed User
Longtime User
Has anyone got an error when using action bar class under Lollipop 5.0.0?

I got an error :
java.lang.IllegalArgumentException: unknown bitmap configuration

The error raised when call to functions
B4X:
AB.SameWidthForAll(True)
AB.AddButton(Null, "System", 5, 1, "SysClick", "")

But change the codes to this
B4X:
AB.SameWidthForAll(False)
AB.AddButton(Null, "System", 5, 1, "SysClick", "")

No error raised. Tested it under an Genymotion Emulator. Don't have a change to test it on real device cause don't have device with Lollipop.
 

Informatix

Expert
Licensed User
Longtime User

Tested with 5.1 on a Nexus 7: no error.
Do you use the latest version?
 

Traiser

Member
Licensed User
Longtime User
hi, if i set the height panel at 50 the icon dimension is 50 , how to reduce only dimension icon? Thanks
 

kepler

Active Member
Licensed User
Longtime User
Hi,

Great work.

Just one question: is there a way to change the tab color? I've tryed:

B4X:
pnlAB.Color = Colors.ARGB(255,204,204,204)

but it didn't work...

Kind regards,

Kepler
 

cimperia

Active Member
Licensed User
Longtime User
Do you mean, the "line", orange or gray, at the base of the tab? If it is what you mean then the class uses png files to set them.
 

cimperia

Active Member
Licensed User
Longtime User

I misread your question. You can change the panel color this way:
B4X:
  pnlAB.AsPanel.Color = Colors.ARGB(255,204,204,204)
 

kepler

Active Member
Licensed User
Longtime User
Hi Informatix

I've got a question. The Action Bar doesn't work if we compile the B4A app in the obfuscated mode code release.

Any ideas how to handle this problem?

Kind regards,

Kepler
 

kepler

Active Member
Licensed User
Longtime User
Hi,

Not quite... I've remembered the rules for obfuscating. I was calling one of the menus like this:

B4X:
AB.AddButton(LoadBitmap(File.DirAssets, "home.png"), "", 4, 1, "Home", "")

The action parameter "Home" is turned into a string - so it's not assumed as the defined action. If we, however, put "Home_m" (notice the "_", no blank spaces) as the action, the string is not modified, and everything goes right

Kind regards,

Kepler
 

Informatix

Expert
Licensed User
Longtime User
The action parameter "Home" is turned into a string - so it's not assumed as the defined action.

??? I don't understand what you mean.
This parameter is the event name (the complete name of the sub handling the event) so you have to name it like an event name, e.g. Home_Click. Look at the demo. If you name it only "Home", it is not properly named and it won't work with obfuscation.
 

kepler

Active Member
Licensed User
Longtime User
Hi,

Yes, I've realized that. But it's not necessary to put, for instance, the "_Click" text.
I was using it - wrongly - calling a routine like this:

B4X:
Sub Home (ActionBar As ClsActionBar, Btn As View)

And it worked with no obfuscation.

Now, I'm calling:

B4X:
Sub Home_m (ActionBar As ClsActionBar, Btn As View)

And it works aswell - obfuscated or not.

Either way, the action must not have any white spaces, otherwise it won't work if the code is obfuscated - that's my assumption.

Kind regards,

Kepler
 

Peter Simpson

Expert
Licensed User
Longtime User
I've come across underscore (_) issues previously too, but with WebViewExtra. I was going to mention adding an underscore as explained by @wonder in another post, I also believe that @Erel has explained about this too. I was not 100% sure if adding an underscore would work for you though, so I never posted a response @kepler.
 
Last edited:

Adilson Jacinto

Active Member
Licensed User
Longtime User

How do I change the color text of the other buttons when not active?
I know AB.SetText(Btn, "Q-List", Colors.Yellow, -1 ) will set the color for that button but what about make the others white?

Thanks
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…