Skip to content

Instantly share code, notes, and snippets.

@mahdimortazavi
Created May 11, 2016 20:06
Show Gist options
  • Save mahdimortazavi/a3c98ca8ff2b0c85f498a70ad5f7f37b to your computer and use it in GitHub Desktop.
Save mahdimortazavi/a3c98ca8ff2b0c85f498a70ad5f7f37b to your computer and use it in GitHub Desktop.
public void dialogView() {
final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
LayoutInflater inflater = mActivity.getLayoutInflater();
View content = inflater.inflate(R.layout.dialog_layout_view, null);
builder.setView(content);
((TextView) content.findViewById(R.id.tv_onvan_view)).setText(R.string.dialog_onvan);
//--------------------------------------------------
builder.setPositiveButton(mContext.getString(R.string.dialog_update_btn), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
System.out.println(dbhand.getMartyrId());
ShaidListReq(dbhand.getMartyrId());
}
});
//----------------------------------------------------
builder.setNegativeButton(mContext.getString(R.string.dialog_cancel_btn), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
//-----------------------------------------------
final AlertDialog alertDialog =builder.create();
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Typeface tf = Typeface.createFromAsset(mContext.getAssets(), "fonts/irsensnumeral.ttf");
((Button)alertDialog.getButton(Dialog.BUTTON_POSITIVE)).setTypeface(tf);
((Button)alertDialog.getButton(Dialog.BUTTON_NEGATIVE)).setTypeface(tf);
}
});
alertDialog.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment