2014-05-20 46 views
4

我有服務實現IntentService和OnHandleIntent我想開始活動。如何從intentservice開始活動?

它不工作:

Intent dialogIntent = new Intent(this, typeof(Activity1)); 
dialogIntent.AddFlags(ActivityFlags.NewTask); 
this.StartActivity(dialogIntent); 

我還有什麼可以嘗試一下呢?

upd:AddFlags(ActivityFlags.NewTask);它does not幫助

+0

你有沒有找到你的問題soln?如果是的話,請分享。也可以看看:「http://stackoverflow.com/questions/3606596/android-start-activity-from-service」 – Basher51

回答

7
Intent dialogIntent = new Intent(getBaseContext(), MainActivity.class); 
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
getApplication().startActivity(dialogIntent); 
+0

非常感謝。有用 –