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


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
AlertDialog شخصی سازی شده و دریافت اطلاعات

AlertDialog شخصی سازی شده و دریافت اطلاعات

#1
یه AlertDialog دارم که یه لایه براش طراحی کردم که فقط یه EditText داره می خوام با زدن دکمه تایید محتویات EditText رو بگیرم
کدش رو به این صورت نوشتم اما موقع اجرا کرش میکنه
کد:
private void runAlert() {

   LayoutInflater aInflater = getActivity().getLayoutInflater();
   final View dialogView  =aInflater.inflate(R.layout.custom_dialog_mojodi, null);

   new AlertDialog.Builder(getActivity())
     .setTitle("افزایش موجودی")
     .setCancelable(false)
     .setView(dialogView )
     .setPositiveButton("تایید", new DialogInterface.OnClickListener() {
       @Override
       public void onClick(DialogInterface dialogInterface, int i) {
          final EditText Increase =  dialogView.findViewById(R.id.Increase);

         Increase = Increase.getText().toString();
         Toast.makeText(getActivity(),Increase.getText().to  String();, Toast.LENGTH_SHORT).show();

       }

     })

     .setNegativeButton("نیازی نیست" ,null)
     .create()
     .show();

 }
پاسخ


پیام‌های این موضوع
AlertDialog شخصی سازی شده و دریافت اطلاعات - توسط Nassim_20 - ۱۳۹۸/۰۹/۱۱, ۰۲:۰۴ ب.ظ

پرش به انجمن:


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