We have seen quite a few examples of AlertDialog with one button, two and three buttons. It is possible to create a AlertDialog that behaves just like Toast messages. The only difference is that the message will stay visible until user taps on the screen outside the dialog message pop-up.

Android AlertDialog with No Buttons
Example :
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("AlertDialog with No Buttons");
builder.setMessage("Hide this message by just tapping anywhere outside the dialog box!");
AlertDialog diag = builder.create();
//Display the message!
diag.show();
}
More Posts related to Android,
- Android Error Unexpected cast to Button: layout tag was FrameLayout
- ADT quit unexpectedly error on Mac OSX Android Eclipse SDK
- Parsing Data for android-21 failed unsupported major.minor version 51.0
- Android Studio Ctrl Shift o auto import not working
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
- Android : How to make TextView Scrollable
- This class should be public (android.support.v7.internal.widget.ActionBarView.HomeView) Lint Error
- Integrating Android Facebook SDK 3.17.2 Tutorial
- Android R Cannot Be Resolved To A Variable
- Android : Exception raised during rendering: action_bar API 22
- How to take screenshot on Android
- Read Text file from SD Card : Android Programming
- How to make Android EditText not editable
- Your Android SDK is out of date or is missing templates. Please ensure you are using SDK version 22 or later.
- The declared package does not match the expected package Eclipse
- Can't Run SDK Manager find_java.bat issue
- What is Android Toast.LENGTH_SHORT and Toast. LENGTH_LONG durations
- Android Emulator Soft Back button action using Computer keyboard
- Multiline EditText in Android Example
- Use 5G Network on Android Emulator
- Make Android TextView Clickable like Buttons
- How to empty trash in Android Device
- Android : Execute some code after back button is pressed
- Disable Fading Edges Scroll Effect Android Views
- How To Disable Landscape Mode in Android Application
More Posts:
- Install Microsoft Remote Desktop (RDP) Client on Mac - Microsoft
- PowerShell iterate and get all SharePoint sites and sub sites - SharePoint
- 🌗 List of Solar Eclipses in the year 2020-2021 🌑 - Science
- Java 8 JDBC: Insert Timestamp Code Example - Java
- MySQL ERROR 1064 (42000): You have an error in your SQL syntax [fix] - MySQL
- How to use Content Assist in Eclipse IDE - Eclipse
- Fetch More then 10 Links Per Page in Google Search Result - Google
- Java monitoring and management console [jconsole] - Java