Android Tutorial Make your app compatible with Android 5.0 devices

Discussion in 'Tutorials & Examples' started by Erel, Oct 23, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

    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).
    Code:
    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: Oct 2, 2016
  2. corwin42

    corwin42 Expert Licensed User

  3. Erel

    Erel Administrator Staff Member Licensed User

    It should load the default theme if the selected theme is missing.
     
    Peter Simpson likes this.
  4. TheMightySwe

    TheMightySwe Active Member Licensed User

    If you don't use any theme, shall you use this row in the manifest anyway?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Unless you test your app with the new material theme.
     
  6. corwin42

    corwin42 Expert Licensed User

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

    gadgetmonster Active Member Licensed 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?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    It will be fixed in the next version of B4A (probably in a month or two).
     
  9. gadgetmonster

    gadgetmonster Active Member Licensed User

    Is there not a work around for now as this will give the user a poor experience, they are going to expect to be able to tap the button to open the menu or go back?
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Unfortunately no.
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    This is not the place to ask this question. Sorry.
     
  12. tdocs2

    tdocs2 Well-Known Member Licensed User

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

    Sandy
     
    Last edited: Nov 25, 2014
  13. gadgetmonster

    gadgetmonster Active Member Licensed User

    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.
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    NJDude likes this.
  15. bluedude

    bluedude Well-Known Member Licensed 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.
     
  16. Laurent95

    Laurent95 Active Member Licensed User

    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
    Code:
    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.
     

    Attached Files:

    Last edited: Nov 30, 2014
  17. hmotiwala

    hmotiwala Member Licensed 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.
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    Have you added the line from the first post to the manifest editor?
     
  19. hmotiwala

    hmotiwala Member Licensed User

    Yes, I did that but the problem with ListView remains same.
     
  20. Erel

    Erel Administrator Staff Member Licensed User

    Please try to reproduce it in a small project and upload the project.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice