title: Item Position in RecyclerView and SharedPreferences
body: <p>I have a RecyclerView that when the user clicks any item it will open an activity which the user must finish some tasks and if the user completes the tasks, it will be recorded in a SharePrefrences (Up to here there's no problem) then if the user returns to the recyclerView an image which I already defined in the layout will be Visible which means this step is finished already. But here comes the problem when the user after finishing the tasks returns to the recyclerView except for the selected item some of the other items also visible in the image.</p>
  <p><strong>For example</strong>, I click item one and finish all the tasks then return to the recyclerView, and except Item one, item 8, 16, and 24 also Visible the image.
  Here is the necessary code to see:</p>
  <p>In the Task activity:</p>
  <pre><code>private void trophyGiftRecycler() {
  
          if ((Integer)img_test1_p1.getTag()==R.drawable.alph1_a) {
              SharedPreferences prefs1 = getSharedPreferences(&quot;prefs1&quot;, MODE_PRIVATE);
              boolean letter1 = prefs1.getBoolean(&quot;letter1&quot;, true);
              if (letter1) {
                  trophyShared();
              }
          }
  }
  
  private void trophyShared() {
  
          if ((Integer)img_test1_p1.getTag()==R.drawable.alph1_a) {
              SharedPreferences prefs1 = getSharedPreferences(&quot;prefs1&quot;, MODE_PRIVATE);
              SharedPreferences.Editor editor = prefs1.edit();
              editor.putBoolean(&quot;letter1&quot;, true);
              editor.apply();
          }
  }
  
  In the MainAdapter
  
  @Override
      public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) {
  
          holder.itemLetter.setImageResource(mainModelAlphabets.get(position).getItemImages());
          holder.itemTxt.setImageResource(mainModelAlphabets.get(position).getItemTxt());
  
          holder.itemLetter.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  if(canStart) {
                      canStart = false; // do canStart false
                      // Do what you don't want to run twice due to double tap
  
                      if (position==0){
  
                          Activity activity = (Activity) context;
                          Intent intent = new Intent(context,Alphabet2.class);
                          intent.putExtra(&quot;alphabet_word1&quot;,R.drawable.alphabet_a1);
                          intent.putExtra(&quot;alphabet_word2&quot;,R.drawable.alphabet_a2);
                          intent.putExtra(&quot;alphabet_word3&quot;,R.drawable.alphabet_a3);
                          activity.startActivity(intent);
                          activity.overridePendingTransition(R.anim.activity_slide_in_left,R.anim.activity_slide_out_right);
  
                          Runtime.getRuntime().gc();
                          activity.onBackPressed();
                      }
  
                      if (position==1){
  
                          Activity activity = (Activity) context;
                          Intent intent = new Intent(context,Alphabet2.class);
                          intent.putExtra(&quot;alphabet_word1&quot;,R.drawable.alphabet_b1);
                          intent.putExtra(&quot;alphabet_word2&quot;,R.drawable.alphabet_b2);
                          intent.putExtra(&quot;alphabet_word3&quot;,R.drawable.alphabet_b3);
                          activity.startActivity(intent);
                          activity.overridePendingTransition(R.anim.activity_slide_in_left,R.anim.activity_slide_out_right);
  
                          Runtime.getRuntime().gc();
                          activity.onBackPressed();
                      }
  
          });
  
          setAnimation(holder.itemView,position);
  
  
          SharedPreferences prefs1 = context.getSharedPreferences(&quot;prefs1&quot;, MODE_PRIVATE);
          SharedPreferences prefs2 = context.getSharedPreferences(&quot;prefs2&quot;, MODE_PRIVATE);
  
          boolean letter1 = prefs1.getBoolean(&quot;letter1&quot;, false);
          boolean letter2 = prefs2.getBoolean(&quot;letter2&quot;, false);
  
  
          if (letter1){
              if (position==0){
                  holder.itemTrophy.setVisibility(View.VISIBLE);
              }
          }
  
          if (letter2){
              if (position==1){
                  holder.itemTrophy.setVisibility(View.VISIBLE);
              }
          }
  
      }
  </code></pre>
  <p>As you can see it is supposed to visible the image in positions 1 or 2 but it visible in other positions (not all_ as well.</p>