打开Android小部件屏幕Android

时间:2016-08-19 16:52:05

标签: android

如何打开应用程序|小工具屏幕?
我的意思是这个屏幕

enter image description here

1 个答案:

答案 0 :(得分:0)

enter image description here

遇到了问题,基本上你所要做的就是做一个选择这个的意图。

 Intent homeScreenIntent = new Intent(Intent.ACTION_MAIN);
 homeScreenIntent.addCategory(Intent.CATEGORY_LAUNCHER);
 homeScreenIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 startActivity(homeScreenIntent); 

希望它有所帮助。

不会推荐,但似乎其中一项可行,但要小心:

moveTaskToBack(true) // Pushes the activity in stack to back.

finish() // Kills the app

参考:Dev blog