可能重複:
How to make a phone call in android and come back to my activity when the call is done?返回到應用的通話結束後
呼叫正在從應用程序通過startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phNo)));
啓動。通話結束後,我不會回到應用程序,而是回到手機的桌面。
我在做什麼錯?是否有可能返回到已發起呼叫的應用程序?我不確定Android是否允許這樣做。
編輯: 代碼添加
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
switch ((int) id) {
case 0:
try {
TextView txtCallDisp = (TextView) findViewById(R.id.itmDdd);
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phNo)));
} catch (NullPointerException e) {
e.printStackTrace();
} catch (Exception ee) {
ee.printStackTrace();
}
break;
//... other switch statements
你能提供樣本代碼嗎? – 2011-05-31 14:38:45
我相信我最近看到這個問題,有人建議添加一個呼叫監聽器,一旦呼叫狀態改變,他們重新開始他們的活動。不確定,但我會看看我能否爲你找到它。 – DustinRiley 2011-05-31 14:46:17
@Deepak我引用的代碼基本上都是代碼。我會在一秒鐘內添加它。 – sandalone 2011-05-31 18:13:40