Created
August 31, 2018 11:07
-
-
Save punit9l/7589b4da380ceb03213495dcff066ef6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void showAlertDialog() { | |
AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
// Get the layout inflater | |
LayoutInflater inflater = getLayoutInflater(); | |
View view = inflater.inflate(R.layout.alert_dialog, null); | |
// Inflate and set the layout for the dialog | |
// Pass null as the parent view because its going in the dialog layout | |
builder.setView(view); | |
final AlertDialog dialog = builder.create(); | |
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); | |
ImageView imageButton = view.findViewById(R.id.imageButton); | |
imageButton.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
dialog.dismiss(); | |
} | |
}); | |
dialog.show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment