Android Alert Modal Popup window using Activity
The following steps will get you a basic set up for a Alert Window, or a Modal or a Popup window which ever you call it, but it’s a screen that shows on top of the previous activity.
1. This is a layout file in the drawable folder, optional but it will make the modal’s corner round. dialog_shape.xml
2. Define the layout file for the activity class which will be used for the popup window. Feel free to modify it accordingly to your needs, it’s the same as any other layout file you would define for an Activity. activity_about.xml
3. Create the Activity class. AboutActivity.java
public class AboutActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); } }
4. Register the Activity class in the manifest file with the configurations for using the theme Theme.AppCompat.Dialog.Alert to make the activity as a Dialog.
Search within Codexpedia
Search the entire web