Created
November 27, 2016 21:02
-
-
Save evasyuk/b18fdc3c0a1547eb19071b66b198a45d to your computer and use it in GitHub Desktop.
This file contains 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
// custom dialog | |
final Dialog dialog = new Dialog(context); | |
dialog.setContentView(R.layout.custom); | |
dialog.setTitle("Title..."); | |
// set the custom dialog components - text, image and button | |
TextView text = (TextView) dialog.findViewById(R.id.text); | |
text.setText("Android custom dialog example!"); | |
ImageView image = (ImageView) dialog.findViewById(R.id.image); | |
image.setImageResource(R.drawable.ic_launcher); | |
Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); | |
// if button is clicked, close the custom dialog | |
dialogButton.setOnClickListener(new OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
dialog.dismiss(); | |
} | |
}); | |
dialog.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment