[Solved] Crashing android application [duplicate]
public void onClick(View v) { AlertDialog.Builder a_builder = new AlertDialog.Builder(MainActivity.this); a_builder.setCancelable(false); a_builder.setTitle(“Alert !”); a_builder.setMessage(“do you want to call!!!”); a_builder.setPositiveButton(“Yes”, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //handle the permission at start. if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { //permission not granted, ask for permission return; } Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(“tel:0000000000”)); … Read more