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

后端 未结 20 2143
北恋
北恋 2020-11-22 12:59

I am launching an activity to make a phone call, but when I pressed the \'end call\' button, it does not go back to my activity. Can you please tell me how can I launch a c

20条回答
  •  清酒与你
    2020-11-22 13:39

    This is regarding the question asked by Starter.

    The problem with your code is that you are not passing the number properly.

    The code should be:

    private OnClickListener next = new OnClickListener() {
    
         public void onClick(View v) {
            EditText num=(EditText)findViewById(R.id.EditText01); 
            String number = "tel:" + num.getText().toString().trim();
            Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(number)); 
            startActivity(callIntent);
        }
    };
    

    Do not forget to add the permission in manifest file.

    
    

    or

    
    

    for emergency number in case DIAL is used.

提交回复
热议问题