Showing posts with label custom alert box. Show all posts
Showing posts with label custom alert box. Show all posts

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.

 

Copyright @ 2013 Android Developers Blog.