title: notifyDataSetChanged mess up my list view
body: <p>I am trying to use <code>notifyDataSetChanged</code> , to update my list view in order to change one row in it from password dots, to plain text and back to password dots.</p>
  
  <p>In my adapter (changed it based on a comment here ) I check the type of the object that I have in that row. If the row is a password I set it to </p>
  
  <pre><code>setTransformationMethod(new PasswordTransformationMethod()); 
  </code></pre>
  
  <p>in order to turn the password text to dots. Later in my activity a click on that row will change it type to "notPass", and I am trying to refresh my listview with <code>notifyDataSetChanged</code> to represent it as a visible text.</p>
  
  <pre><code>public class UserAccountAdapter extends ArrayAdapter&lt;UserAccountData&gt; {
      Context context;
      int layoutResourceId;
      UserAccountData data[] = null;
      TreeSet&lt;String&gt; mSeparatorsSet = new TreeSet&lt;String&gt;();
  
      public UserAccountAdapter(Context context, int layoutResourceId,
              UserAccountData[] data) {
          super(context, layoutResourceId, data);
          this.layoutResourceId = layoutResourceId;
          this.context = context;
          this.data = data;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View row = convertView;
          UserAccountDataHolder holder = null;
  
          if (row == null) {
              LayoutInflater inflater = ((Activity) context).getLayoutInflater();
              row = inflater.inflate(layoutResourceId, parent, false);
  
              holder = new UserAccountDataHolder();
              holder.imgIcon = (ImageView) row.findViewById(R.id.imgUserAccountIcon);
              holder.txtTitle = (TextView) row.findViewById(R.id.txtTitle);
  
  
              row.setTag(holder);
          } else {
              holder = (UserAccountDataHolder) row.getTag();
          }
  
          UserAccountData userAccountData = data[position];
          holder.txtTitle.setText(userAccountData.title); 
          //hold
  
  er.txtTitle.setTransformationMethod(new PasswordTransformationMethod());
              holder.imgIcon.setImageResource(userAccountData.icon);
          if(userAccountData.type.equals("pass")){
  
              ((TextView) row.findViewById(R.id.txtTitle)).setTransformationMethod(new PasswordTransformationMethod());
          }
          else{
              ((TextView) row.findViewById(R.id.txtTitle)).setTransformationMethod(null);
          }
  
  
          return row;
      }
  
      static class UserAccountDataHolder {
          ImageView imgIcon;
          TextView txtTitle;
      }
      }
  </code></pre>
  
  <p>The object that I am giving the adapter is:</p>
  
  <pre><code>public class UserAccountData {
      public int icon;
      public String type;
      public String title;
      public UserAccountData(){
          super();
      }
  
      public UserAccountData(int icon, String title, String type) {
          super();
          this.icon = icon;
          this.title = title;
          this.type = type;
      }
      public void setType(String type){
          this.type = type;
      }
  
  }
  </code></pre>
  
  <p>And my activity part that deals with the clickListener is:</p>
  
  <pre><code> usersArray = new UserAccountData[user_data.size()];
   user_data.toArray(usersArray);
  
   final UserAccountAdapter adapter = new UserAccountAdapter(this,
                                          R.layout.user_accounts_row, usersArray);
  
   userAccountsListView = (ListView) findViewById(R.id.userAccounts);
   userAccountsListView.setAdapter(adapter);
  
   userAccountsListView.setOnItemClickListener(new OnItemClickListener() {
          @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int position, long id) {
              if(adapter.getItem(position).type.equals("pass")){
                  adapter.getItem(position).setType("notPass");
                  adapter.notifyDataSetChanged();
  
  
              }
              else if(adapter.getItem(position).type.equals("notPass")){
                  adapter.getItem(position).setType("pass");
                  adapter.notifyDataSetChanged();
  
              }
  </code></pre>
  
  <p>Right now when I am clicking on a password field with dots, that field remains dotted and some but not all of the other fields that are of type user/email/phone are also turning into dots</p>
  
  <p>Any idea what am I doing wrong?</p>
  
  <p>UPDATE: solved the issue. 
  1) needed an else if, and not if / if.
  2) changed the adapter based on one of the comments</p>