Created
October 15, 2018 08:48
-
-
Save koifish082/8f8cd6163858c45837c1fade5fc31a00 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
public class DialogUtils { | |
public static void showOkButtonDialog(Context context, String message) { | |
View view = LayoutInflater.from(context).inflate(R.layout.view_alert_dialog, null, false); | |
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context); | |
builder.setView(view); | |
android.app.AlertDialog alert = builder.create(); | |
ColorDrawable back = new ColorDrawable(android.graphics.Color.TRANSPARENT); | |
InsetDrawable inset = new InsetDrawable(back, 100); | |
alert.getWindow().setBackgroundDrawable(inset); | |
TextView txtText = view.findViewById(R.id.tv_dialog_content); | |
txtText.setText(message); | |
TextView button = view.findViewById(R.id.tv_dialog_positive); | |
button.setOnClickListener(v -> alert.dismiss()); | |
alert.show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment