/ Published in: Java
                    
                                        
Code Snippet of showing dialog and toast in Android application.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
/**
* Show message by alert
* @param message
* @param c current context
*/
Builder builder = new AlertDialog.Builder(c);
builder.setMessage(message);
builder.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
/**
* Show context on UiThread
* @param message
* @param current context
*/
public void run() {
Toast.makeText(c, msg, Toast.LENGTH_SHORT).show();
}
};
runOnUiThread(showToastTask);
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                