Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onClick(View v){
- //capture number
- String tel=phone.getText().toString();
- //make call
- Intent cIntent=new Intent(Intent.ACTION_CALL);
- cIntent.setData(Uri.parse("tel:"+tel));
- if(ActivityCompat.checkSelfPermission(
- MainActivity.this,
- Manifest.permission.CALL_PHONE )!= PackageManager.PERMISSION_GRANTED)
- {
- return;
- }
- startActivity(cIntent);
- }//end onClick
- //AndroidManifest
- //<uses-permission android:name="android.permission.CALL_PHONE" />
Advertisement
Add Comment
Please, Sign In to add comment