Question

I develop an android application and put it in a android market. users put comments for me and tell me that setting button doesn't work for my application. I don't know what setting button is and how I can enable it for my application. can any one help me?

Was it helpful?

Solution

I guess what you mean is the menu button. The problem often is that some devices don't have a physical menu button, thus they cannot access the menu of your app.

Try to use a Holo theme for your app's activities and show an ActionBar. By default, the three dots button for your menu will then be shown in the ActionBar on devices that don't have a physical menu button.

For a consistend UI on all devices, you could show the menu button in your ActionBar permanently, whether the device has a physical menu button or not, using this code:

if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {        
        try { 
            ViewConfiguration config = ViewConfiguration.get(this);
            Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); 

            if(menuKeyField != null) { 
                menuKeyField.setAccessible(true); 
                menuKeyField.setBoolean(config, false); 
            }

        } catch (Exception e) { e.printStackTrace(); }

    }

OTHER TIPS

Do you use Eclipse? Check if you have a method onCreateOptionsMenu in your activity class. Eclipse creates automatically this method and adds a menu in your activity (depending on how you create the activity class file)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top