title: Set image based on data in getView() method
body: <p><code>Index</code>,<code>Gainers</code>,<code>Losers</code> are the 3 <code>buttons</code>.
  On each <code>button</code> click, <code>listView</code> gets populated with corresponding data.</p>
  <p>3rd column <code>%Chg</code> can be <em>negative</em> or <em>positive</em>.</p>
  <p>Based on value of <code>%Chg</code> value, corresponding <code>arrow</code> should be displayed in <code>imageView</code> placed after <code>%Chg</code> column value i.e. <em>up arrow</em> for <em>positive value</em> and <em>down arrow</em> for <em>negative value</em> ...</p>
  <p>On any <code>button</code> click, I'm passing value of <code>%Chg</code> column in an array named <code>updown</code> to <code>Adapter</code> class</p>
  <p>Based on that value, <code>Adapter</code> should set the <em><code>down arrow</code></em> or <em><code>up arrow</code></em></p>
  <p><strong>Code snippet from Adapter class(getView() method)</strong></p>
  <pre><code>public View getView(int position, View convertView, ViewGroup parent) {
          ViewHolder holder;
          LayoutInflater inflater = activity.getLayoutInflater();
  
          if (convertView == null) {
              convertView = inflater.inflate(R.layout.list_table, null);
              holder = new ViewHolder();
  
              holder.txtFirst = (TextView) convertView
                      .findViewById(R.id.FirstText);
              holder.txtSecond = (TextView) convertView
                      .findViewById(R.id.SecondText);
              holder.txtThird = (TextView) convertView
                      .findViewById(R.id.ThirdText);
              holder.ivarrow = (ImageView) convertView.findViewById(R.id.ivarrow);
              holder.l1 = (LinearLayout) convertView
                      .findViewById(R.id.tableLayout);
  
              convertView.setTag(holder);
  
          } else {
              holder = (ViewHolder) convertView.getTag();
          }
  
          HashMap&lt;String, String&gt; map = list.get(position);
  //Setting the row background
          if (count % 2 == 0) {
              try {
                  InputStream is1 = ctx.getAssets().open(&quot;cellbg.png&quot;);
                  Drawable d1 = Drawable.createFromStream(is1, &quot;cellbg&quot;);
                  holder.l1.setBackgroundDrawable(d1);
  
              } catch (Exception e) {
                  throw new Error(&quot; exception in TableListAdapter &quot;
                          + e.getMessage());
              }
          } else {
              try {
                  InputStream is2 = ctx.getAssets().open(&quot;cellbg1.png&quot;);
                  Drawable d2 = Drawable.createFromStream(is2, &quot;cellbg1&quot;);
                  holder.l1.setBackgroundDrawable(d2);
              } catch (Exception e) {
                  throw new Error(&quot; exception in TableListAdapter &quot;
                          + e.getMessage());
              }
          }
          count++;
  //setting the arrow
          if (i &lt; updown.length) {
              if (updown[i] &gt; 0) {
                  holder.ivarrow.setImageResource(R.drawable.up);
                  Log.v(&quot;up&quot;, &quot;up&quot;);
              } else {
                  holder.ivarrow.setImageResource(R.drawable.down);
                  Log.v(&quot;down&quot;, &quot;down&quot;);
              }
              Log.v(&quot;i=&quot;, i + &quot; ,updown=&quot; + updown[i]);
              i++;
          }
  
          holder.txtFirst.setText(map.get(FIRST_COLUMN));
          holder.txtSecond.setText(map.get(SECOND_COLUMN));
          holder.txtThird.setText(map.get(THIRD_COLUMN));
          return convertView;
      }
  </code></pre>
  <p>.</p>
  <p>Log is showing correct data but <strong>arrow is getting displayed in only 1st row</strong>. i.e. if Last value of list is <code>positive</code>, it shows <code>up arrow</code> to 1st row and if Last value of list is <code>negative</code>, it shows <code>down arrow</code> to 1st row...</p>
  <p><strong>How to display corresponding arrow to each row??</strong></p>
  <p>I'm new to android development. So <em>ANY HELP WILL BE LIFE-SAVER !!!</em>
  .</p>
  <p><img src="https://i.imgur.com/yqQGk.png" alt="screen" /></p>