Professional Documents
Culture Documents
editText);
btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Toast msg = Toast.makeText(getBaseContext(),"Button pressed",
Toast.LENGTH_LONG);
String str = eText.getText().toString();
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+eText.getText()));
if (ActivityCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.CALL_PHONE) !=
PackageManager.PERMISSION_GRANTED) {
return;
}
startActivity(callIntent);