我需要從服務啓動活動。我試着使用:從服務啓動第三方應用程序
public void openApplication(String packageName){
Intent intent = new Intent(packageName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
}
,但我得到這個錯誤:
E/AndroidRuntime(8563):android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.encrypted flg=0x10000000 }
04-30 11:55:07.507: E/AndroidRuntime(8563): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1765)
04-30 11:55:07.507: E/AndroidRuntime(8563): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1485)
任何想法?
您正在使用的'Intent'構造函數採用動作字符串。它不需要包名。顯然,您的設備上沒有任何活動將其包名稱作爲操作字符串。您需要使用標識存在活動的「Intent」。向第三方應用程序的開發者詢問他們建議使用什麼「Intent」。 – CommonsWare