通话结束后返回应用程序

时间:2011-05-31 14:36:42

标签: android

  

可能重复:
  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

2 个答案:

答案 0 :(得分:2)

在您开始通话后有一个听众,完成通话活动,它将重定向回上一个活动(您的应用)。以下是一些示例代码的链接(它是西班牙文,但您至少应该能够编写代码):Returning to App After Phone Call

答案 1 :(得分:-1)

你不能

实例化电话有两种方法。您可以使用电话号码作为URL(正如您所做的那样)或android.intent.action.CALL以电话号码作为URL(再次)发起android.intent.action.DIAL Intent。这两个都启动手机应用程序,它不会自动将控制权返回到您的应用程序。

查看以下网址

How to make a phone call in android and come back to my activity when the call is done?

由于 迪帕克