New feature: better support for modern Android themes

Erel

B4X founder
Staff member
Licensed User
Longtime User
Basic4android v2.20 will better support the new themes introduced in Android 3.x and Android 4.x.

- The targetSdkVersion default value for new projects is now 14 (this can also be easily done with the manifest editor).
- The device visual designer supports the default theme. It also allows you to switch to other themes:

SS-2012-09-11_16.35.38.png


SS-2012-09-11_16.36.14.png


SS-2012-09-11_16.36.51.png


Note that changing the theme on the device only affects the designer. You will also need to set the theme in the manifest editor (if other than the default theme).

- The visual designer now supports a new DEFAULT color. Setting this color means that the theme default color will be used.

- Menu items will now appear in the action bar on devices running Android 3.0 or above.

With that changes it will be much simpler to create modern looking apps.
 

Roger Garstang

Well-Known Member
Licensed User
Longtime User
You just need to open the manifest editor and change 14 to whichever value you need.

That is what I meant when I said I didn't want to override it in the manifest each time. It would be much easier as an option. Android has a very strange way of keeping track of Versions and API levels. Without looking it up or opening the SDK Manager I may not always remember that 10 is Gingerbread, 11 is Honeycomb/Tablet, and 14 is ICS. Would be good to have an option with a description and the API level in parenthesis.

The biggest issue though I see other than ugly graphics is for those wanting to use the ICS+ themes not having a back button. Two devices I've tested on have it not exiting/leaving/going back from an activity. It functions because I get my confirmation prompts I put in the event, but it doesn't actually do anything (I get my prompt asking if I'm sure but it just goes away after I say yes and the activity is still there).
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Make that 3 devices now- Gingerbread Tablet, Honeycomb Tablet, and the Note with ICS. In <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/> if targetSdkVersion is anything greater than 4 my Back button stops working. I even tried leaving off android:minSdkVersion="4" and same results.

So, currently the default is to just have android:minSdkVersion="4" and no target value...so is the default for target then 4??? This would seem to be the case since my Silver Gradient on my tabs I'm used to seeing only draws if target is set to 4 otherwise it is a flat grey with 5-10 and ICS style with higher.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
That is what I meant when I said I didn't want to override it in the manifest each time. It would be much easier as an option.
What do you mean with each time? You just need to open the editor once and set the target version. It is the the same as checking an option in a menu. The manifest editor code is saved as part of the project.

Currently the default target is 4.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
I mean with each new project. And in doing some reading it looks like api5 changed key processing. It added a method for getting back pressed to the activity and a bunch of other new ways to get longpress, capture keys, and see if from virtual or real keyboard. B4A seems to be behaving like true is returned from the new method and ignoring it. So either the new events will be needed or we will have to reverse our key processing to close the activity ourself.
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Does this mean it will allow you to use this new theme for all android devices or only devices running android 3.x & 4.x ?

Also how far away is this new version?
 
Upvote 0

asmag

Member
Licensed User
Longtime User
Update to 2.20 version of basic4android

Hi Erel!

I bought the standard version a few days ago. I will receive the update to version 2.20?

thank you
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
EDIT: and sometimes you need to call it more than 100 times. When you create items in a ScrollView for example.
The layout builder was also optimized for this case. Starting with v2.20 both loading of large layouts and loading the same layout file multiple times will be much faster (~400% faster).
 
Upvote 0

MaxApps

Active Member
Licensed User
Longtime User
Hi Erel

This is really nice:sign0098:
Especially AutoScaleAll. This will cut hours and hours of programming and testing and we can focus on more interesting things, than transforming layout to different screen sizes.

Kind regards
Jakob

Ups. Wrong thread. Should have been in the thread with Autoscaling
 
Last edited:
Upvote 0

jcesar

Active Member
Licensed User
Longtime User
Note that changing the theme on the device only affects the designer. You will also need to set the theme in the manifest editor (if other than the default theme).

I´m trying without sucess. How can i do this ?
 
Upvote 0

salmander

Active Member
Licensed User
Longtime User
Hi Erel,

Sorry to not clarify myself, I meant that when you add items to the activity by activity.addMenuItems3, it add the menu item to the title bar. However, in Android there is a 3 dot menu icon on the top title bar for ICS devices and higher.

Thanks
 
Upvote 0
Top