在我的應用程序,我有一個名爲EXIT按鈕,當用戶點擊的是,我要完成我的應用程序的所有活動,這是在堆棧,並轉到默認主頁活動或所有應用中的活動。如何以編程方式進入Android的默認主屏幕?
我寫了下面的代碼在我onClick()
:
Intent intent = new Intent(Intent.CATEGORY_HOME);
startActivity(intent);
但它給我的logcat以下錯誤:
03-12 11:22:18.279: ERROR/AndroidRuntime(308): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.category.HOME }
那麼,我需要做的,實現這一目標?我需要在清單中進行一些配置還是我的方法錯誤?
可能重複(http://stackoverflow.com/questions/3724509 /以編程方式進入主屏幕) – 2014-03-01 16:45:58