Android 中按home键和跳转到主界面的实例代码
程序员文章站
2022-06-02 22:14:52
//home
intent intent= new intent(intent.action_main);
intent.setflags(intent.fl...
//home
intent intent= new intent(intent.action_main); intent.setflags(intent.flag_activity_new_task); //如果是服务里调用,必须加入new task标识 intent.addcategory(intent.category_home); startactivity(intent);
//主界面
intent intent = new intent(intent.action_main,null); ntent.addcategory(intent.category_home); startactivity(intent);
//音量减
audiomanager maudiomanager = (audiomanager) getsystemservice(context.audio_service); maudiomanager.adjuststreamvolume(audiomanager.stream_music, audiomanager.adjust_lower, audiomanager.fx_focus_navigation_up); maudiomanager.adjuststreamvolume(audiomanager.stream_music, audiomanager.adjust_lower, audiomanager.fx_focus_navigation_up);
以上所述是小编给大家介绍的android 中按home键和跳转到主界面的实例代码,希望对大家有所帮助