I want to create a custom dialog box like below
I have tried the foll
It's a class for Alert Dialog so that u can call the class from any activity to reuse the code.
public class MessageOkFragmentDialog extends DialogFragment {
Typeface Lato;
String message = " ";
String title = " ";
int messageID = 0;
public MessageOkFragmentDialog(String message, String title) {
this.message = message;
this.title = title;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View convertview = inflater.inflate(R.layout.dialog_message_ok_box, null);
Constants.overrideFonts(getActivity(), convertview);
Lato = Typeface
.createFromAsset(getActivity().getAssets(), "font/Lato-Regular.ttf");
TextView textmessage = (TextView) convertview
.findViewById(R.id.textView_dialog);
TextView textview_dialog_title = (TextView) convertview.findViewById(R.id.textview_dialog_title);
textmessage.setTypeface(Lato);
textview_dialog_title.setTypeface(Lato);
textmessage.setText(message);
textview_dialog_title.setText(title);
Button button_ok = (Button) convertview
.findViewById(R.id.button_dialog);
button_ok.setTypeface(Lato);
builder.setView(convertview);
button_ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
dismiss();
}
});
return builder.create();
}
}
Xml file for the same is: