title: Android Validating the user input in edittext not working in adapter?
body: <p>I want to take the first and last name from a user and the number of input changes dynamically; while validating the input it does not work.</p>
  
  <p>The code for  validating is ;</p>
  
  <pre><code>public class IndividualAdapter extends ArrayAdapter&lt;Individual&gt; {
      List&lt;Individual&gt; individualList;
      LayoutInflater vi;
      ViewHolder holder;
  
      public IndividualAdapter(Context context, List&lt;Individual&gt; objects) {
          super(context, R.layout.inidividual_list, objects);
          vi = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          individualList = objects;
      }
      static class ViewHolder {
          public EditText edtfName;
          public EditText edtlName;
          private TextView txtType;
      }
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View v = convertView;
          Individual ind = getItem(position);
          if (v == null) {
              holder = new ViewHolder();
              v = vi.inflate(R.layout.inidividual_list, parent, true);
              holder.edtfName = (EditText)findViewById(R.id.fst_name);
              holder.edtlName = (EditText)findViewById(R.id.lst_name);
              holder.txtType = (TextView)findViewById(R.id.typeValue);
          }
          holder.txtType.setText(ind.getType());
          String fName = holder.edtfName.getText().toString().trim();
          String lName = holder.edtlName.getText().toString().trim();
          if (fName.equals(" ")) {
              holder.edtfName.setError("First Name Can not be empty");
              holder.edtfName.setText("First Name Can not be empty");
          }
          if (lName.equals(" ")) {
              holder.edtlName.setError("Last Name Can not be empty");
              holder.edtlName.setText("Last Name Can not be empty");
          }
          return v;
      }
  }
  </code></pre>
  
  <p>My app crashes as soon as I click on the next button after filing the text field.<br>
  Without filling the field it does not show up any errors.</p>