making phone call from DialogBox in Android -
I have a dialog box with 2 buttons. If we click on the + ve button, it tries to open the dialing pad; And if we click on the button, it closes the dialog when I click on the + ve button, it shows a zero exception if the same code is executed without the dialog box, then it is fine.
Here's my code:
callDialog.setPositiveButton ("Call Now", New Android. Dialogue Interface. OnClickListener () {@Override Click Public Zero ( DialogInterface dialogue, int) {intial dial = new intent (); dial .set action ("android.intent.action.DIAL"), {dial.Setdata (Uri. Telephone: 9951037343); initial activity (dial); } Catch (Exception e) {Log. ("Calling", "" + E. Message ());}}} I use & lt; Permission is permitted as Android: n Ame = "android.permission.CALL_PHONE" />
Try it out.
intent to call = new intent (int. Action_dial); call.setData (Uri.parse ("telephone: phononumber"); initialization (call); < / Div>
Comments
Post a Comment