title: Puting the heart in the listView and changing heart's color by onclick
body: <p>I want to have a heart without color in the listView when I clicked on it, its color turns red and save when exit the app.</p>
  
  <p><a href="https://i.stack.imgur.com/n55uN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n55uN.png" alt="enter image description here"></a></p>
  
  <p>The StructAnatomy class:</p>
  
  <pre><code>public class StructAnatomy {
  
      public String title;
  
      //public ImageView heart_empty;
  
      //public boolean   done;
  }
  </code></pre>
  
  <p>THe AdapterAnatomy class:</p>
  
  <p>the heart_impty is an image that no color and heart_fill has color.</p>
  
  <pre><code>public class AdapterAnatomy extends ArrayAdapter&lt;StructAnatomy&gt; {
  
      public AdapterAnatomy(ArrayList&lt;StructAnatomy&gt; array) {
  
          super(G.context, R.layout.adapter_anatomy, array);
      }
      public static class ViewHolder {
  
          public ViewGroup layoutRoot;
          public TextView  txtTitle;
  
          //public ImageView heart_empty;
  
           public ViewHolder(View view) {
              layoutRoot = (ViewGroup) view.findViewById(R.id.layoutRoot);
              txtTitle = (TextView) view.findViewById(R.id.txtTitle);
              //heart_empty.setImageResource(R.drawable.heart_fill);
          }
  
  
          public void fill(ArrayAdapter&lt;StructAnatomy&gt; adapter, StructAnatomy item, final int position) {
              txtTitle.setText(item.title);
              //heart_empty.setEnabled(item.done);
              layoutRoot.setOnClickListener(new OnClickListener() {
  
               //******************************************************************************************
                  @Override
                  public void onClick(View arg0) {
                      Intent intent = new Intent(G.currentActivity, Anatomy1_2.class);
                      intent.putExtra("POSITION", position);
                      G.currentActivity.startActivity(intent);
                   }
  
              });
          }
       }
  
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          ViewHolder holder;
  
          StructAnatomy item = getItem(position);
          if (convertView == null) {
              convertView = G.inflater.inflate(R.layout.adapter_anatomy, parent, false);
              holder = new ViewHolder(convertView);
              convertView.setTag(holder);
          } else {
              holder = (ViewHolder) convertView.getTag();
          }
  
          holder.fill(this, item, position);
          return convertView;
      }
  }
  </code></pre>