title: Chaining dialogs in jQuery mobile: second dialog disappears in Android
body: <p>I am developing a Facebook app with jQuery mobile, where I create a dialog that creates a second dialog (chaining).</p>
  
  <p>The issue is that with Android and Opera, that second dialog is displayed for a second, and disappears.</p>
  
  <p>Is there a way to avoid this behaviour?
  Otherwise, how can I destroy the first dialog without destroying the second one?</p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>function function1(item) {        
         showDialog(..., function(){
                 ...
                 if (appInstalled == true) {                        
                         if(function2(item) == true) { 
                                 //call to alert dialog function2
                         }
                 } 
         });
  }
  
  function function2(item) {
         if (...) {
                 showAlertDialog(item.name, messages.MATCH_CONFIRMATION_MSG, item.picture.data.url, '#friendsPage');
                 $('#dialog').dialog('close');
                 $('#alertDialogTrickLink').click();//this is event for going to dialog 
         } 
  
  }
  
  function showDialog(title, content, img, hrefURL, hrefURLcancel, callbackFunction) {
         $('#dialog-content').html(content);
         $('#dialogHeader').text(title);
         if (img != null) {
                 $('#dialog-img').html('&lt;img src="' + img +'" alt="" class="bigImg" /&gt;');
         } else {
                 $('#dialog-img').html('');
         }
         var a = messages.ACCEPT_BUTTON_TEXT;
         var c = messages.CANCEL_BUTTON_TEXT;
         $('#dialogActions').html(
                 '&lt;a href="' + hrefURL + '" data-role="button" data-theme="c" id="confirmDialogAction" data-icon="check" data-iconpos="left"&gt;' + a + '&lt;/a&gt;' +       
                 '&lt;a href="' + hrefURLcancel + '" data-role="button" id="skipDialogAction" data-icon="delete" data-iconpos="left"&gt;' + c + '&lt;/a&gt;'
         );
         $('#confirmDialogAction').click(function(e) {
                 e.preventDefault();
                 callbackFunction();
         });
         $('#dialog').trigger('create');
  }
  </code></pre>
  
  <p>Thanks a mill</p>