Android 台灣中文網

標題: 在自製APP裡開啟Gmail應用程式 On Jelly Bean 版本 [打印本頁]

作者: jackyai6    時間: 2013-2-26 10:47
標題: 在自製APP裡開啟Gmail應用程式 On Jelly Bean 版本
這是我在之前版本的片段程式碼:

Intent mailClient = new Intent(Intent.ACTION_VIEW);
mailClient.setClassName("com.google.android.gm", "com.google.android.gm.ConversationListActivity");
startActivity(mailClient);

自從手機更新到4.1.2版本之後,在運行時就會產生問題:

E/AndroidRuntime(19630): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.gm/com.google.android.gm.ComposeActivityGmail}; have you declared this activity in your AndroidManifest.xml?

搜尋後是有人說因為在Jelly Bean版本"com.google.android.gm.ConversationListActivity"的名稱和路徑改變了,變成"com.android.mail.compose.ComposeActivity"

我修改後↓

Intent mailClient = new Intent(Intent.ACTION_VIEW);
mailClient.setClassName("com.google.android.gm", "com.android.mail.compose.ComposeActivity");
startActivity(mailClient);

還是會造成應用程式的錯誤,有大大可以幫我解惑一下嗎?
不知道懸賞會不會有差,不過小弟我還是意思意思一下...
作者: ploglin    時間: 2013-2-26 17:17
錯誤訊息是一樣的嗎?
作者: jackyai6    時間: 2013-2-26 17:34
ploglin 發表於 2013-2-26 17:17
錯誤訊息是一樣的嗎?

是的,錯誤訊息一樣
作者: ploglin    時間: 2013-2-27 11:06
我沒處理過這段,不過跟 Android 版本有關的話,會不會是要用 API 版本,而你用的是沒有 API 的版本?
作者: jackyai6    時間: 2013-2-27 13:15
ploglin 發表於 2013-2-27 11:06
我沒處理過這段,不過跟 Android 版本有關的話,會不會是要用 API 版本,而你用的是沒有 API 的版本? ...

我試過用2.3.3(API10)以及4.1.2(API16)去運作,還是錯誤...TT..TT




歡迎光臨 Android 台灣中文網 (https://apk.tw/) Powered by Discuz! X3.1