다이얼로그에서 확인버튼 누를때

 

자료명을 입력안했으면 토스트 띄우면서 확인 안눌리게 하는 방법 없나요??

 

쉽게...

자료명을 입력하지 않은 상태에서 확인 버튼 누를때

토스트로

자료명을 입력하세요

띄우고 확인버튼을 눌러도 반응이 없거나 안눌리게요...

어떻게 해야하져...?

 

 

   private void showAlertDialog(final View view){

       LayoutInflater vi=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
       LinearLayout addition=(LinearLayout)vi.inflate(R.layout.sub2, null);
      
       final EditText name=(EditText)addition.findViewById(R.id.cls);

       new AlertDialog.Builder(this)
       .setTitle("추가하기 ")
       .setView(addition)
      
       .setPositiveButton("확인", new DialogInterface.OnClickListener() {
    
     public void onClick(DialogInterface dialog, int which) {
      String str=null;
      str=name.getText().toString();
      time.get(i).btname.setText(str);
      time.get(i).btname.setBackgroundColor(col2[i]);

      grid.setAdapter(adapter);
      adapter.notifyDataSetChanged();      
      
     }  
    }
       ).setNegativeButton("취소", null)
       .show();

 

 

 

 

소스는 이런식이에요... 조금 생략한 부분이 있지만;