Disabling the hardware menu button [MIT AI2]

NKoyD

Possibility to completely remove option Menu.
Unchecking the Title Visible just hides Actionbar and Menu but doesn’t disable it. If there is any hardware Menu button on the phone it still shows option Menu after unchecking Title Visibly.

Solution one

Use any decompiling method that support smali

Decompiled Apk

Go to your folder/path (Your Apk name)


..Your_Apk_name\smali\com\google\appinventor\components\runtime

find and open Form.smali file for editing, I recommend Notepad++ for this.

find .method public onCreateOptionsMenu


.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 3
    .param p1, "menu"    # Landroid/view/Menu;

    .prologue
    .line 2170
    invoke-super {p0, p1}, Lcom/google/appinventor/components/runtime/AppInventorCompatActivity;->onCreateOptionsMenu(Landroid/view/Menu;)Z

    .line 2173
    invoke-virtual {p0, p1}, Lcom/google/appinventor/components/runtime/Form;->addExitButtonToMenu(Landroid/view/Menu;)V

    .line 2174
    invoke-virtual {p0, p1}, Lcom/google/appinventor/components/runtime/Form;->addAboutInfoToMenu(Landroid/view/Menu;)V

    .line 2175
    iget-object v1, p0, Lcom/google/appinventor/components/runtime/Form;->onCreateOptionsMenuListeners:Ljava/util/Set;

    invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/google/appinventor/components/runtime/OnCreateOptionsMenuListener;

    .line 2176
    .local v0, "onCreateOptionsMenuListener":Lcom/google/appinventor/components/runtime/OnCreateOptionsMenuListener;
    invoke-interface {v0, p1}, Lcom/google/appinventor/components/runtime/OnCreateOptionsMenuListener;->onCreateOptionsMenu(Landroid/view/Menu;)V

    goto :goto_0

    .line 2178
    .end local v0    # "onCreateOptionsMenuListener":Lcom/google/appinventor/components/runtime/OnCreateOptionsMenuListener;
    :cond_0
    const/4 v1, 0x1

    return v1
.end method

edit const/v4 v1, 0x1 to const/v4 v1, 0x0


    goto :goto_0

    .line 2178
    .end local v0    # "onCreateOptionsMenuListener":Lcom/google/appinventor/components/runtime/OnCreateOptionsMenuListener;
    :cond_0
    const/4 v1, 0x0

    return v1

Done, build your Apk.

Solution two


After Toni provided his solution for Disabling the hardware menu button, doing it with Apk Modder will be far easier.

Designer Properties

Screen1

Sizing: Responsive
ShowStatusBar: Checked
TitleVisible: Checked

We will control StatusBar and Title with Apk Modder

Launch Apk Modder

Select Apk tab and choose the Select apk to decompile.

Decompile should take a couple of seconds to be completed.

Select Options tab and choose under Directories Decompile dir.

Go to “your_project_name.apk\smali\com\google\appinventor\components\runtime\form.smali” and select to edit form.smali.

Make sure to select from
.method public onCreateOptionsMenu(Landroid/view/Menu;)Z to .end method and delete that part, do not forget to save.

Make the necessary changes in the Manifest file.

Build new apk.

Finalize apk.

And that’s all….

8 comments

Skip to comment form

  1. Where can i download apk modder?

    • eriks on April 30, 2016 at 1:37 am
    • Reply

    can I leave ShowStatusBar and TitleVisible to unchecked?

    1. Try and see what happens if you do so.
      However, I recommend that you choose Theme.NoTitleBar.Fullscreen for that purpose.

  2. how to download apk modder??> pledgie.com/campaigns/28753 not show any download link. please give a another download link of any other website like google drive, mediafire etc

    1. Unfortunately, I do not have a direct link for download because you have to go through the gwayapps forum.
      https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!forum/gwayapps

    • masrukhin on April 8, 2019 at 5:01 am
    • Reply

    I’m making a multiple choice quiz application, but the home button, minimize, and the status bar above still work. how to keep students working on the home button, minimiz and status bar so that students can’t browse

    1. I’m somewhat unclear in your inquiry

      /Boban

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.