Friday, 3 August 2012

Show Custom Alert Box| Dialogue Box in Phone Gap Application

Phonegap alert box

Hello Friends,


Here , I am sharing my code in which we show custom alert box in
Phone Gap Application ,Same as Android and Iphone.

In My Html code i am calling logout() method on button(Logout) click Which show
A confirmation alert box.


The Java Script code which i am using is:

<script type="text/javascript">
function  logout() {
    showConfirm();
}

function showConfirm() {
    navigator.notification.confirm(
        'Are you sure?',  // message
        onConfirm,        // callback to invoke with index of button pressed
        'Logout',         // title
        'Ok,Cancel'       // buttonLabels
    );
}

//process the confirmation dialog result
function onConfirm(button) {
    if(button==1){
        //your code
    }else {
      //your code
    }
}
</script>

Hope , this will Helps any one.

Mukesh Yadav

Hi Guys I am from Delhi working as Web/Mobile Application Developer(Android Developer), also have knowledge of Roboelctric and Mockito ,android test driven development... Blogging has been my passion and I think blogging is one of the powerful medium to share knowledge and ideas....

1 comments:

  1. Can you write a project demo ? Please !!!

    ReplyDelete

 

Copyright @ 2013 Android Developer Blog.

Blog Widget by LinkWithin