title: remove previously highlighted item in listview after click on new item
body: <p>I have a listview. On this listview, I highlighted the text of a listview item. When I click on another item in the listview, I want to remove the textcolor and text style of the previous item.</p>
  
  <p>here is the listview adapter code `</p>
  
  <pre><code>public class SubLessionAdapter extends ArrayAdapter&lt;SubLessionDetail&gt; {
  Context context;
  int resource, textViewResourceId;
  List&lt;SubLessionDetail&gt; items;
  List&lt;SubLessionDetail&gt; tempItems;
  List&lt;SubLessionDetail&gt; suggestions;
  private Dialog pinDialog;
  private EditText popup_title, popup_review;
  private TextView submit;
  private RatingBar rating;
  private String flag;
  private VideoList videoList;
  private CourseListMain myCourseListMain;
  SubLessionAdapter.ViewHolder publicholder;
  SharedPreferences pref;
  SharedPreferences.Editor editor;
  int listposition;
  
  String topic_position,course_position,lession_position,item_id;
  
  public SubLessionAdapter(Context dummyTopicList, ArrayList&lt;SubLessionDetail&gt; lessionLIstDetails, String flag,String course_position,String topic_position,String lession_position,String item_id) {
      super(dummyTopicList, 0, lessionLIstDetails);
      this.context = dummyTopicList;
      this.items = lessionLIstDetails;
      this.flag=flag;
      this.course_position=course_position;
      this.topic_position=topic_position;
      this.lession_position=lession_position;
      this.item_id=item_id;
  
  
      pref = getContext().getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
      editor = pref.edit();
  
  
      myCourseListMain = PrefUtils.getMyCourse(getContext());
      listposition = pref.getInt("sublistpostion",0);
  
  }
  
  
  private class ViewHolder {
  
      TextView title;
      ImageView img_lock,download_green,download_gray,itemcheckded;
      LinearLayout topic;
  
  
  }
  
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
      SubLessionAdapter.ViewHolder holder = null;
  
  
  
      if (convertView == null) {
  
          LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
          convertView = inflater.inflate(R.layout.list_topics, parent, false);
  
          holder = new SubLessionAdapter.ViewHolder();
          holder.topic =(LinearLayout)convertView.findViewById(R.id.topic);
          holder.title = (TextView) convertView.findViewById(R.id.title);
          holder.img_lock = (ImageView) convertView.findViewById(R.id.img_lock);
          holder.download_gray=(ImageView)convertView.findViewById(R.id.downlaod_gray_sublist);
          holder.download_green=(ImageView)convertView.findViewById(R.id.download_green_sublist);
          holder.itemcheckded =(ImageView)convertView.findViewById(R.id.itemchecked);
  
          convertView.setTag(holder);
  
      }
      else
      {
          holder = (SubLessionAdapter.ViewHolder) convertView.getTag();
      }
  
  
      SubLessionDetail productItems = items.get(position);
      holder.title.setText( productItems.getTitle());
      if (productItems.getLocked().equals("1")) {holder.img_lock.setVisibility(View.GONE);} else {holder.img_lock.setVisibility(View.VISIBLE);}
      if (flag.equals("my_course")){holder.img_lock.setVisibility(View.GONE);}else {holder.img_lock.setVisibility(View.VISIBLE);}
  
  
  
      if(listposition==position){
  
          holder.title.setTypeface(null, Typeface.BOLD);
          holder.title.setTextColor(Color.parseColor("#4dd289"));
      }else{
          holder.title.setTypeface(null, Typeface.NORMAL);
          holder.title.setTextColor(Color.parseColor("#000000"));
      }
  
  
      final ViewHolder finalHolder = holder;
      convertView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
  
              finalHolder.title.setTypeface(null, Typeface.BOLD);
              finalHolder.title.setTextColor(Color.parseColor("#4dd289"));
             // finalHolder.itemcheckded.setVisibility(View.VISIBLE);
  
              switch (flag) {
  
                  case "my_course":
  
                      Intent intent = new Intent(getContext(), ContentTabActivity.class);
                      intent.putExtra("titlevalue",myCourseListMain.getCourseArrayList().get(Integer.parseInt(course_position)).getTopicListMain().getTopicDetailsArrayList().get(Integer.parseInt(topic_position)).getLessionArrayList().get(Integer.parseInt(lession_position)).getLessionLIstDetailArrayList().get(position).getTitle());
                      intent.putExtra("lession_id", myCourseListMain.getCourseArrayList().get(Integer.parseInt(course_position)).getTopicListMain().getTopicDetailsArrayList().get(Integer.parseInt(topic_position)).getLessionArrayList().get(Integer.parseInt(lession_position)).getLessionLIstDetailArrayList().get(position).getLession_id());
                      intent.putExtra("id", item_id);
                      intent.putExtra("lession_position", lession_position);
                      intent.putExtra("postion_current_selected_item",position+"");
                      intent.putExtra("course_position", course_position);
                      intent.putExtra("topic_position", topic_position);
                      editor.putString("sublession_has_1_item","no");
                      editor.putInt("sublistpostion",position);
                      editor.commit();
                      context.startActivity(intent);
  
  
                      break;
  
  
                  case "curriculam":
                      Toast.makeText(getContext(), "Content is Locked", Toast.LENGTH_SHORT).show();
                      break;
  
              }
  
          }
      });
  
  
      return convertView;
  
  }
  </code></pre>
  
  <p>}
  `</p>
  
  <p>What happens now is when i click on the item, it changes textstyle and textcolor, but the previous item is still highlighted.</p>
  
  <p>I want to highlight only one item at a time (clear the highlighting from the previous item).</p>
  
  <p>below are some images of what's happening right now.</p>
  
  <p><a href="https://i.stack.imgur.com/ffTAz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ffTAz.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/JyROg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JyROg.png" alt="enter image description here"></a></p>