5 Replies Latest reply on Sep 5, 2012 12:06 PM by Hector Meza

    Disable Menu Button on Android

      We are doing a production build of our application with DEBUGBUTTONSENABLED set to 0 in our config.xml file.  When we install the apk the menu button (hard button farthest right, beside back and home) enables a menu with options for the user.  We would like to disable the ability to use that button.  This is being done on an ET1.  How would we disable that menu showing when the menu button is pressed?



        • Re: Disable Menu Button on Android

          There appears to be some options to configure the menu options, but setting that to nil does not make it disappear. 

          • Re: Disable Menu Button on Android

            In your app folder there is a file named application.rb which inherits from Rho::RhoApplication.


            Here you can define what the menu on Android will look like.


            The following will only show the home, refresh and close items.


            @default_menu = { Rho::RhoMessages.get_message('home_menu') => :home, Rho::RhoMessages.get_message('refresh_menu') => :refresh,

                  #Rho::RhoMessages.get_message('close_menu') => :close }


            If you want to completely remove the menu just use


            @default_menu = {}




            @default_menu = nil


            Please don't edit the file Rho::RhoApplication as this is a shared file in the framework used by all your Rhodes applications.

              • Re: Disable Menu Button on Android

                This does not appear to disable the menu at all times.  When we start our application where the initial startup page is not named index.html we do not see the menu. 


                When our application comes up the menu is disabled.  In our sample code below, when we tap the button on screen (which makes a call to through ajax to ruby) the menu becomes enabled.


                Here is an example of what we are doing. 


                On the Ruby side:


                require 'rho/rhocontroller'

                #require 'helpers/application_helper'

                require 'helpers/browser_helper'

                class ClientController < Rho::RhoController

                  include BrowserHelper

                  def getConfig


                    test_content = 'Hello World'

                    puts "test_content : #{test_content}"

                    render :string => test_content


                      error_message = "#{$!}"

                      Alert.show_popup error_message





                JS code


                function myFunction()

                {document.getElementById("demo").innerHTML="External JS Function same directory";}

                function getClient(){


                          url: "/app/Client/getConfig",

                          type: "GET",

                          cache: false,

                          async: false,

                          success: function(data)





                          error: function (XMLHttpRequest, textStatus, errorThrown) {






                HTML code:


                <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

                <html lang="en-GB">


                <META http-equiv="Content-Type" content="text/html; charset=UTF-8">

                <title>HM Test</title>

                <script type="text/javascript" src="jquery-1.6.1.min.js"></script>

                <script type="text/javascript" src="myScript.js"></script>

                <META http-equiv="quitbutton" content="visibility:visible;" />  



                          <p id="demo">A Paragraph.</p>

                          <button type="button" onclick="getClient()">Try it</button>

                          <p><strong>Note:</strong> The actual script is in an external script file called "myScript.js".</p>




                Let me know if there are any questions on this example.  I can also email our project over as well.