Android Question App crash pressing the menu button

Discussion in 'Android Questions' started by Alberto Michelis, Jun 23, 2015.

  1. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    Hi,
    Im testing with 4.4.2
    My app uses the PopupMenu of the StdActionBarHelper Library
    I dont have any AddmenuItem in any module
    A user install my app in android 2.2,it works ok but when he accidentally pressed the menu button ( from the device) suddenly appears:
    popup > press here
    and then the app crashed.
    Any Idea of how to deal with it?
    Thanks
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the code that handles the menu button?
     
  3. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    I didnt think it was important because there are no

    Code:
    'Activity_create....
     Activity.AddMenuItem3("Popup""Menu"LoadBitmap(File.DirAssets, "ic_menurayitas.png"), True)
     
    Activity.AddMenuItem3("Ayuda""mnuAyuda"LoadBitmap(File.DirAssets, "ic_help_circle.png"), True)


    Sub Menu_Click
       
    Log("Show popup")

       
    'add the dummy view to the activity
       dummy.Initialize("")
       
    Activity.AddView(dummy, 80%x01dip1dip)
       dummy.Color = 
    Colors.Transparent

       
    'Create and show popup menu
       Dim pop As PopupMenu
       pop.Initialize(
    "ABPop", dummy)
       
       pop.AddMenuItem(
    0"Agregar Especie " , GetDrawable("ic_mas_especie"))
       pop.AddMenuItem(
    1"Agregar Efectivo ", GetDrawable("ic_mas_pesos"))
       pop.AddMenuItem(
    2"Grafico por Especie ", GetDrawable("ic_chart_pie"))
       pop.AddMenuItem(
    3"Grafico por Panel ", GetDrawable("ic_chart_arc"))
       pop.Show
       
    End Sub
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Please also post the error message from the logs.

    Try to use CallSubDelayed to call another sub that will then create the PopupMenu and show it.
     
    Peter Simpson likes this.
  5. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    Sory cant post it because it happened in a client phone.
    Will try the CallSubDelayed
     
Loading...