title: Android List View duplicate values on scroll in Adapter
body: <p>I am binding data to a List View control in Android. The data is stored in an ArrayList. In the getView() function of the Adapter, I get the entire list consisting of 23 items. In case the 'selectedval' is '1', I set values to the TextView in the Row. </p>
  
  <p>However , despite the List consisting of 23 unique values I see duplicate values in the View. On debugging, I see that the values get duplicated on scroll.</p>
  
  <p>Here is the code for the getView() function.</p>
  
  <pre><code>@SuppressLint("InflateParams")
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
  
      View mView = convertView;
  
      if (mView == null){
          mView = mInflator.inflate(R.layout.custom_rate_card, null);
          FancyTextview mTxtName = (FancyTextview)mView.findViewById(R.id.txt_list_name);
          FancyTextview mTxtPrice = (FancyTextview)mView.findViewById(R.id.txt_list_price);
  
          if(selectedVal == 0){
              String laundryPrice = mRateCardData.get(position).getLaundryPrice();
              if(Integer.parseInt(laundryPrice) != 0 &amp;&amp; laundryPrice != null)
              {   
                  mTxtName.setText(mRateCardData.get(position).getName());
                  mTxtPrice.setText(laundryPrice);
              }
          }
          if(selectedVal == 1){
              String IPrice = mRateCardData.get(position).getIroningPrice();
              String Iname = mRateCardData.get(position).getName();
              if(Integer.parseInt(IPrice) != 0 &amp;&amp; IPrice != null)
              {
                  mTxtPrice.setText(IPrice);
                  mTxtName.setText(Iname);
              }
          }
          return mView;
      }
      else{
          return mView;
      }
  }
  </code></pre>
  
  <p>I searched for this and think its got to do with the recycling of the view. But I have been unable to solve it.</p>
  
  <p>Any help will be appreciated. Thanks.</p>