Title

Monday, 19 January 2015

making phone call from DialogBox in Android


I've a one DialogBox with 2 buttons,if we click +ve button,it attempts to open the Dialing Pad,else if click -ve button close the dialog,thats it.When I click the +ve button it shows > the null exception.If the same code execute in without DialogBox,it is fine. Here is my code.

callDialog.setPositiveButton("Call Now", new android.DialogInterface.  OnClickListener() {  @Override  public void onClick(DialogInterface dialog, int which) {  Intent dial = new Intent();  dial.setAction("android.intent.action.DIAL");  try {  dial.setData(Uri.parse("tel:101"));  startActivity(dial);  } catch (Exception e) {  Log.e("Calling",""+e.getMessage());  }

And I've given the permissions in manifest file as

Answer

where are you getting the null pointer exception ?

No comments:

Post a Comment