openSearch() in Android beginners app not defined

前端 未结 3 1692
说谎
说谎 2020-12-03 10:42

I\'m just started the Android beginners tutotial and I now face a problem. On this page under \"Respond to Action Buttons\" it tells me to define a switch statement with som

3条回答
  •  误落风尘
    2020-12-03 11:05

    This is the code that you have to use in those methods:

    private void openSearch(){
        startActivity(new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH));
    }
    
    private void openSettings(){
        startActivity(new Intent(Settings.ACTION_SETTINGS));
    }
    

    The openSearch() method execute the google global search of the cellphone. The openSettings() method open the global configuration of the cellphone.

    I'm also a beginner in android,hope this helps with the question. Good Luck

提交回复
热议问题