custom dialog که باز نمی شود

ساخت وبلاگ
با سلام
من یک کدی نوشتم که می بایست بعد از انتخاب هر کدام از radio button ها صفحه custom dialog باز شود ولی نمی شود و خطا هم نمی دهد لطفا کمکم کنید.
این هم کد java صفحه مورد نظر فقط import ها را پاک کردم :
کد java :
package com.example.barname_n_rooze;


Context context=this;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);


txt_tarikhe_yadavari = (TextView) findViewById(R.id.txt_tarikhe_yadavari);
pdp3 = (PersianDatePicker) findViewById(R.id.pdp3);
txt_dar_saaate = (TextView) findViewById(R.id.txt_dar_saaate);
radiobutton1_3 = (RadioButton) findViewById(R.id.radiobutton1_3);
radiobutton2_3 = (RadioButton) findViewById(R.id.radiobutton2_3);
radiobutton3_3 = (RadioButton) findViewById(R.id.radiobutton3_3);
radiobutton4_3 = (RadioButton) findViewById(R.id.radiobutton4_3);
//timepicker1_3 = (TimePicker) findViewById(R.id.timepicker1_3);
txt_matne_yadavari = (TextView) findViewById(R.id.txt_matne_yadavari);
edt_matne_yadavari = (EditText) findViewById(R.id.edt_matne_yadavari);
btn_next_step3 = (Button) findViewById(R.id.btn_next_step3);




PersianCalendar p = pdp3.getDisplayPersianDate();
String s1_3 = edt_matne_yadavari.getText().toString();




if(radiobutton1_3.isChecked() ){


customDialog();


}else if(radiobutton2_3.isChecked()){


customDialog();


}else if(radiobutton3_3.isChecked() ){


customDialog();


}else if( radiobutton4_3.isChecked()){


customDialog();


}
}


private void customDialog () {


final EditText hour, minute ,second;


LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.timepickerdialog1, null);


AlertDialog.Builder alertDialogBuilder1 = new AlertDialog.Builder(this);
alertDialogBuilder1.setView(view);
//alertDialogBuilder1.setTitle("سلام");
//alertDialogBuilder1.setMessage("زمان مورد نظر خود را انتخاب کنید");
alertDialogBuilder1.setCancelable(true);
alertDialogBuilder1.setPositiveButton("ذخیره", null);
alertDialogBuilder1.setNegativeButton("لغو", null);




hour = (EditText)view.findViewById(R.id.hour);
minute=(EditText)view.findViewById(R.id.minute);
second=(EditText)view.findViewById(R.id.second);


final AlertDialog alertDialog = alertDialogBuilder1.create();
alertDialog.show();


alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Button btnPositive=alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
btnPositive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
}
});
Button btnNegative=alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
btnNegative.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {


alertDialog.dismiss();
}
});
}
});
}
}




دوستان موقع ساخت صفحه custom dialog باید مقدار هر کدام از موارد زیر چی باشه شاید اینجا اشتباه کردم خودم یادم نیست فقط
اولی رو
(Resource type رو)xml زدم :
Resource type ,Root element ,Directory name

:گریه::گریه::گریه::گریه::گریه: :گریه::گریه:




تمپوs...
ما را در سایت تمپوs دنبال می کنید

برچسب : نویسنده : خنج tempos بازدید : 188 تاريخ : شنبه 12 مرداد 1398 ساعت: 13:26