انجمن سایت کلیدستان


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
کاستوم دیالوگ در برنامه نویسی اندروید

کاستوم دیالوگ در برنامه نویسی اندروید

#7
دوست عزیز کل کدو میذارم براتون تا بهتر متوجه مشکل شوید
در ضمن فایل  xml تعریف شده!!

کد پی‌اچ‌پی:
final Dialog dialog = new Dialog(MainActivity.this);
        
dialog.setContentView(R.layout.dialogboxcustom);
        
dialog.setTitle("خروج از برنامه");

        
// set the custom dialog components - text, image and button
        
TextView text = (TextViewdialog.findViewById(R.id.text);
        
text.setText("آیا می خواهید از برنامه خارج شوید؟");
        
        [
color=#FF0000]dialog.getWindow();
        
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);[/color]
        

        
Button Ok_btn = (Buttondialog.findViewById(R.id.dialogButtonOK);
        
// if button is clicked, close the custom dialog
        
Ok_btn.setOnClickListener(new OnClickListener() {
            @
Override
            
public void onClick(View v) {
                
                
finish();
                
            }
        });
        
Button No_btn = (Buttondialog.findViewById(R.id.dialogButtonNO);
        
// if button is clicked, close the custom dialog
        
No_btn.setOnClickListener(new OnClickListener() {
            @
Override
            
public void onClick(View v) {
            
                
dialog.dismiss();
            }
        });

        
dialog.show();

    } 

در قسمتی که مشخص کرده ام عینا کد شما را نوشته ام اما force close  میدهد!!!

 
پاسخ


پیام‌های این موضوع
RE: کاستوم دیالوگ - توسط aliasghar - ۱۳۹۳/۰۸/۱۲, ۰۳:۱۴ ق.ظ
RE: کاستوم دیالوگ در برنامه نویسی اندروید - توسط md98 - ۱۳۹۳/۰۹/۰۱, ۱۰:۱۵ ق.ظ

پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان