title: How to Create Validation in Spinner in android?
body: <p>How to use Set Error in Spinner? I tried by typecast textview but it do not generate error message. </p>
  
  <pre><code>submitBt.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
          String patt = "";
          boolean b1 = check(name, patt);
          if (!b1) {
              allergy_nameEt.setError("Enter Disease Name");
              return;
          }
          boolean patt1 = doctor_name.getSelectedItem().toString().equals("Select Doctor");
          boolean b2 = check(spin, String.valueOf(patt1));
          if (!b2) {
              ((TextView) doctor_name.getSelectedView()).setError("Please Select Doctor");
              return;
          } else {
              new allergy_category().execute();
          }
      }
  }
  </code></pre>