Android Tutorial Make your app compatible with Android 5.0 devices

This is an old thread. It is not relevant if you are using newer versions of B4A.

In order for your current applications to run properly on Android 5.0 devices you need to:

1. Compile your app with B4A v3.82+
2. Add this line to the manifest editor (assuming that you didn't set a different theme).
B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
Without this line the new material theme will be used. The material theme (at least currently) has some issues that can break existing layouts.
3. If you are using the StdActionBar and handling the ButtonClicked event then you need to update the library to v1.52 (otherwise the app will crash). Note that the ButtonClicked event will not be raised on Android 5 devices.
You should handle the Activity_ActionBarHomeClick event instead of StdActionBar_ButtonClicked event. The Activity_ActionBarHomeClick event will work on all versions.
 
Last edited:

corwin42

Expert
Licensed User
Longtime User

corwin42

Expert
Licensed User
Longtime User
It should load the default theme if the selected theme is missing.

Oops, correct. I had in my mind that this won't work.
 

tdocs2

Well-Known Member
Licensed User
Longtime User
This is not the place to ask this question. Sorry.

My sincere apologies, Erel. I Have deleted the post. I am extremely appreciative to you and B4A and to the community.

Sandy
 
Last edited:

gadgetmonster

Active Member
Licensed User
Longtime User
It will be fixed in the next version of B4A (probably in a month or two).

Hi Erel,

Is there anyway you could release a maintenance build containing this fix? The problem I see is that this is a major button in any UI that uses it. Users are going to want to press it as it (in my case) is used to display a slide out menu and used on some screens as a way to navigate back to the previous screen. I know there are other ways to accomplish this such as sliding the menu out and pressing the devices back key to return to the previous screen, BUT, the button is there and if users press it and it does nothing it will generate negative feedback (been there before).

Looking forward to your reply.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Within a few weeks Lollipop will popup everywhere because lots of manufacturers are working on an update. I think we will see Lollipop soon on many devices. Kitkat has gained lots of traction in a short time.
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Erel
I am using the std action bar library extensively in my app but as you stated above, the button click has been disabled. Is this going to be fixed anytime soon?

Hi all,

In first i want to say that i believe that Lollipop will become utilised many more, it manages the battery life better than Kitkat and it's waited by many user.

I don't know if it's related also with stdActionBar, but i use the module clsActionBar with AHQuickActionMenu on my widget and i have find this :

Code extracted of my Sub
B4X:
Sub MenuAB_Click(ActionBar As ClsActionBar, Btn As View)
  'Now search the ID of the item clicked
   Dim tmpTag, tmpString As String
   tmpTag = Btn.Tag
   If tmpTag.Contains("OnLongClickSub") Then
#If Debug
     Log("Btn.Tag: " & Btn.Tag)
#End If
     tmpString = tmpTag.Replace("OnLongClickSub","#")
#If Debug
     Log("tmpString1: " & tmpString)
#End If
     tmpString = tmpString.SubString(tmpString.IndexOf("#")+2)
     tmpString = tmpString.SubString2(0,tmpString.IndexOf(","))
#If Debug
     Log("tmpString2: " & tmpString)
     Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1)))   'Here there is a chr10 (LF) at end
#End If
     tmpString = tmpString.Replace("_LongClick","")
#If Debug
     Log("tmpString2: " & tmpString)
     Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1)))   'Here the same chr10 at end also, any test you do with the variable tmpString after don't work.
     ' See the log attached
     ' I don't know if it's due to SubString2 or Replace  but with Android 4.x i haven't this problem before.
#End If
     tmpString = tmpString.Trim             ' <- ' I have add this and that's work now
#If Debug
     Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1)))   'Here nothing more than the SubString who is needed.
     Log("Sender: " & tmpString)
#End If
   End If
.../....
End Sub

If that can help.
Sorry Erel if it's not the good place for put it. But i think it's maybe possible it's the same problem for the stdActionBar.

Regards.
 

Attachments

  • logActionBar.txt
    328 bytes · Views: 585
Last edited:

hmotiwala

Member
Licensed User
Longtime User
I have an application where I have a ListView placed on a panel on a Tabhost. Users of android 5.0 L are reporting that the Listview cannot be scrolled at all, however it is not frozen in the sense that an item can be clicked on but the list just doesn't scroll.
This issue appears only when running on Android 5.0 Lollipop so was wondering if anyone else has experienced the same kind of behavior and found any solutions. Unfortunately I don't have an Android 5.0 device yet so can't debug this further.
 
Top