找不到处理Intent的活动{act = android.intent.action.CALL

时间:2016-04-11 00:45:53

标签: android android-intent android-activity handle

当我运行应用程序时出现致命异常错误

  

android.content.ActivityNotFoundException:找不到处理Intent的活动


public class MainActivity extends AppCompatActivity {

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //  get butten
        Button  bt= (Button) findViewById(R.id.bt);
        // set a monitor
        bt.setOnClickListener(new MyListener());
    }

    class MyListener implements View.OnClickListener{
        public void onClick(View v) {
            EditText et = (EditText) findViewById(R.id.et);
            String number = et.getText().toString();
            Intent intent = new Intent();

            intent.setAction(Intent.ACTION_CALL);
            intent.setData(Uri.parse("tel"+number));
            startActivity(intent);
        }
    }
}

ScreenShot

0 个答案:

没有答案