Android Question MenuItem Click Event Force Closes After End Sub

Discussion in 'Android Questions' started by Robert Grabowski, Jul 29, 2015.

  1. Robert Grabowski

    Robert Grabowski Member Licensed User

    Using the standard action bar or the new app compatibility bars, the following scenario force closes the app within 1 to 3 executions of the menu's click event providing absolutely no log information:

    Create overflow menu item.
    Activity.AddMenuItem("Fun Fact""mnuFun")
    Create click event to handle the item.
    Sub mnuFun_Click
    Msgbox("This app will force close AFTER the End Sub""Force Close Fun")
    End Sub
    Upon clicking on the menu item between 1 and 3 times, the app will force close. It is chronic when Msgbox or Msgbox2 is in the sub, but it happens under many other conditions. The crash happens somewhere after the End Sub and control never returns to anywhere in the app.

    Target devices run Android 5.1. Target SDK 21 and 22 exhibit this behavior. B4A 5.02, up to the minute Android SDK, Java JDK 8.

    I really need to be able to use overflow menu items again.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Use CallSubDelayed and call a sub that will then show the msgbox.
  3. Robert Grabowski

    Robert Grabowski Member Licensed User

    I used CallSubDelayed in all my menu click events and it resolved the force close issue in my 10 Activity app.

    Thanks again for a great product, excellent technical support, and a pretty good forum.
    Erel likes this.
  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