zoepenn 2017-04-19 15:36 采纳率: 0%
浏览 4257

Android打电话出现No Activity found to handle Intent

用了android官方BLE的demo可以成功接收Arduino101板子传入的数据;
在原来的程序中直接加入打电话的代码,可以成功拨打电话

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gatt_services_characteristics);

        final Intent intent = getIntent();
        mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
        mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);

        // Sets up UI references.
        ((TextView) findViewById(R.id.device_address)).setText(mDeviceAddress);
        mGattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);//characteristics列表
        mGattServicesList.setOnChildClickListener(servicesListClickListner);
        mConnectionState = (TextView) findViewById(R.id.connection_state);
        mDataDisplay = (TextView) findViewById(R.id.data_value);

        getActionBar().setTitle(mDeviceName);
        getActionBar().setDisplayHomeAsUpEnabled(true);
        Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
        bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);

        button = (Button) findViewById(R.id.button);

        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Intent callIntent = new Intent(Intent.ACTION_CALL);
                callIntent.setData(Uri.parse("tel:000000"));
                }
            }
        });
    }

但如果改成根据数据的不同,拨打不同电话,就会停止工作,并且报错No Activity found to handle Intent { act=android.intent.action.CALL }

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gatt_services_characteristics);

        final Intent intent = getIntent();
        mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
        mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);

        // Sets up UI references.
        ((TextView) findViewById(R.id.device_address)).setText(mDeviceAddress);
        mGattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);//characteristics列表
        mGattServicesList.setOnChildClickListener(servicesListClickListner);
        mConnectionState = (TextView) findViewById(R.id.connection_state);
        mDataDisplay = (TextView) findViewById(R.id.data_value);

        getActionBar().setTitle(mDeviceName);
        getActionBar().setDisplayHomeAsUpEnabled(true);
        Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
        bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);

        button = (Button) findViewById(R.id.button);

        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Intent callIntent = new Intent(Intent.ACTION_CALL);

                if (number == "00") {
                    callIntent.setData(Uri.parse("tel:000000"));
                    startActivity(callIntent);
                }else if (number == "01") {
                    callIntent.setData(Uri.parse("tel:000001"));
                    startActivity(callIntent);
                }else if (number == "02") {
                    callIntent.setData(Uri.parse("tel:000002"));
                    startActivity(callIntent);
                }else if (number == "03") {
                    callIntent.setData(Uri.parse("tel:000003"));
                    startActivity(callIntent);
                }else if (number == "04") {
                    callIntent.setData(Uri.parse("tel:000004"));
                    startActivity(callIntent);
                }else if (number == "05") {
                    callIntent.setData(Uri.parse("tel:000005"));
                    startActivity(callIntent);
                }
            }
        });
    }

麻烦各位大神帮忙看一下!!!谢谢!!!

  • 写回答

1条回答 默认 最新

  • devmiao 2017-04-19 15:54
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?