title: How to change TypeFace from BOLD to NORMAL once data updated on recyclerview adapter?
body: <p>I'm working with Firebase data and <code>RecyclerView</code> <code>Adapter</code>. </p>
  
  <p>The scenario is when user click the list, the initial status was <code>UNREAD</code> will be change to <code>READ</code> so the <code>TypeFace</code> should be change from <code>BOLD</code> to <code>NORMAL</code>. </p>
  
  <p>My current back-end process to change the status from <code>UNREAD</code> to <code>READ</code> is working and updated to Firebase, however the interface of my specific <code>RecyclerView</code> item does not change from <code>BOLD</code> to <code>NORMAL</code>. </p>
  
  <p>What I thought is no need to recall back the <strong><em>Firebase data</em></strong> in order to read the status but the interface should change based on user click.</p>
  
  <p><strong><em>Anyone can help me?</em></strong></p>
  
  <hr>
  
  <p><strong><em><code>NotificationActivity.java</code></em></strong>:</p>
  
  <pre><code>package com.myapp.activity.notification;
  
  import android.os.Bundle;
  import android.support.annotation.NonNull;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.view.ActionMode;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.LinearLayout;
  import android.widget.Toast;
  
  import com.google.android.gms.tasks.OnCompleteListener;
  import com.google.android.gms.tasks.Task;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.database.DataSnapshot;
  import com.google.firebase.database.DatabaseError;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  import com.google.firebase.database.ValueEventListener;
  import com.google.gson.Gson;
  import com.google.gson.GsonBuilder;
  import com.material.nereeducation.R;
  import com.material.nereeducation.adapter.AdapterNotification;
  import com.material.nereeducation.model.Notification;
  import com.material.nereeducation.utils.Tools;
  import com.material.nereeducation.widget.LineItemDecoration;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class NotificationActivity extends AppCompatActivity {
  
      private RecyclerView recyclerView;
      private AdapterNotification mAdapter;
      private ActionModeCallback actionModeCallback;
      private ActionMode actionMode;
      private Toolbar toolbar;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_notification);
  
          initToolbar();
          initComponent();
          Tools.setSystemBarColor(this, R.color.black);
      }
  
      private void initToolbar() {
          toolbar = findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          getSupportActionBar().setTitle("Notifications");
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      }
  
      private List&lt;Notification&gt; items = new ArrayList&lt;&gt;();
      private LinearLayout messageEmptyList;
      private void initComponent() {
  
          messageEmptyList = findViewById(R.id.messageEmptyList);
          recyclerView = findViewById(R.id.recyclerView);
          recyclerView.setLayoutManager(new LinearLayoutManager(this));
          recyclerView.addItemDecoration(new LineItemDecoration(this, LinearLayout.VERTICAL));
          recyclerView.setHasFixedSize(true);
  
          //set data and list adapter
          mAdapter = new AdapterNotification(this, items);
          recyclerView.setAdapter(mAdapter);
          mAdapter.setOnClickListener(new AdapterNotification.OnClickListener() {
  
              @Override
              public void onItemClick(View view, Notification obj, int pos) {
                  if (mAdapter.getSelectedItemCount() &gt; 0) {
                      enableActionMode(pos);
                  } else {
                      // read the inbox which removes bold from the row
                      Notification notification = mAdapter.getItem(pos);
                      Toast.makeText(getApplicationContext(), "Read: " + notification.sender_id, Toast.LENGTH_SHORT).show();
  
                      updateStatus(notification.notificationId,"read",pos);
  
                  }
              }
  
              @Override
              public void onItemLongClick(View view, Notification obj, int pos) {
                  enableActionMode(pos);
              }
          });
  
          actionModeCallback = new ActionModeCallback();
  
          getNotificationData();
  
      }
  
      private void getNotificationData()
      {
          items.clear();
          GsonBuilder builder = new GsonBuilder();
          final Gson gson = builder.create();
  
          FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
          String uuid = firebaseAuth.getUid();
  
          FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
          DatabaseReference databaseReference = firebaseDatabase.getReference();
  
          databaseReference.child("notifications/"+uuid+"/data_notification").orderByChild("status").startAt("read").endAt("unread").addListenerForSingleValueEvent(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  if(dataSnapshot.getValue() != null)
                  {
                      for(DataSnapshot snapshot: dataSnapshot.getChildren())
                      {
                          String dataReceived = gson.toJson(snapshot.getValue());
                          Notification notificationItems = gson.fromJson(dataReceived, Notification.class);
                          items.add(notificationItems);
                      }
                      mAdapter.notifyDataSetChanged();
                  }else
                  {
                      messageEmptyList.setVisibility(View.VISIBLE);
                  }
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
      }
  
      private void updateStatus(final String notificationId, String status, final int position) {
          FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
          String uuid = firebaseAuth.getUid();
  
          FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
          DatabaseReference databaseReference = firebaseDatabase.getReference();
  
          databaseReference.child("notifications/"+uuid+"/data_notification").child(notificationId).child("status").setValue(status
          ).addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
              @Override
              public void onComplete(@NonNull Task&lt;Void&gt; task) {
                  mAdapter.notifyItemChanged(position); //Problem here - how to update text from BOLD to NORMAL for this item?
              }
          });
      }
  
      private void enableActionMode(int position) {
          if (actionMode == null) {
              actionMode = startSupportActionMode(actionModeCallback);
          }
          toggleSelection(position);
      }
  
      private void toggleSelection(int position) {
          mAdapter.toggleSelection(position);
          int count = mAdapter.getSelectedItemCount();
  
          if (count == 0) {
              actionMode.finish();
          } else {
              actionMode.setTitle(String.valueOf(count));
              actionMode.invalidate();
          }
      }
  
      private class ActionModeCallback implements ActionMode.Callback {
          @Override
          public boolean onCreateActionMode(ActionMode mode, Menu menu) {
              mode.getMenuInflater().inflate(R.menu.menu_delete, menu);
              return true;
          }
  
          @Override
          public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
              return false;
          }
  
          @Override
          public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
              int id = item.getItemId();
              if (id == R.id.action_delete) {
                  deleteInboxes();
                  mode.finish();
                  return true;
              }
              return false;
          }
  
          @Override
          public void onDestroyActionMode(ActionMode mode) {
              mAdapter.clearSelections();
              actionMode = null;
          }
      }
  
      private void deleteInboxes() {
          List&lt;Integer&gt; selectedItemPositions = mAdapter.getSelectedItems();
          for (int i = selectedItemPositions.size() - 1; i &gt;= 0; i--) {
              mAdapter.removeData(selectedItemPositions.get(i));
          }
          mAdapter.notifyDataSetChanged();
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if (item.getItemId() == android.R.id.home) {
              finish();
          } else {
              Toast.makeText(getApplicationContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p><strong><em><code>AdapterNotification.java</code></em></strong>:</p>
  
  <pre><code>package com.myapp.adapter;
  
  import android.content.Context;
  import android.graphics.Color;
  import android.graphics.PorterDuff;
  import android.graphics.Typeface;
  import android.support.v7.widget.RecyclerView;
  import android.text.format.DateUtils;
  import android.util.SparseBooleanArray;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ImageView;
  import android.widget.RelativeLayout;
  import android.widget.TextView;
  
  import com.material.nereeducation.R;
  import com.material.nereeducation.helper.AlphabetColor;
  import com.material.nereeducation.model.Notification;
  import com.material.nereeducation.utils.Tools;
  
  import java.util.ArrayList;
  import java.util.Date;
  import java.util.List;
  
  public class AdapterNotification extends RecyclerView.Adapter&lt;AdapterNotification.ViewHolder&gt; {
  
      private Context ctx;
      private List&lt;Notification&gt; items;
      private OnClickListener onClickListener = null;
  
      private SparseBooleanArray selected_items;
      private int current_selected_idx = -1;
  
      private AlphabetColor alphabetColor;
  
      public void setOnClickListener(OnClickListener onClickListener) {
          this.onClickListener = onClickListener;
      }
  
  
      public class ViewHolder extends RecyclerView.ViewHolder {
  
          public TextView from, title, message, date, image_letter;
          public ImageView image;
          public RelativeLayout lyt_checked, lyt_image;
          public View lyt_parent;
  
          public ViewHolder(View view) {
              super(view);
              from = view.findViewById(R.id.from);
              title = view.findViewById(R.id.title);
              message = view.findViewById(R.id.message);
              date = view.findViewById(R.id.date);
              image_letter = view.findViewById(R.id.image_letter);
              image = view.findViewById(R.id.image);
              lyt_checked = view.findViewById(R.id.lyt_checked);
              lyt_image = view.findViewById(R.id.lyt_image);
              lyt_parent = view.findViewById(R.id.lyt_parent);
          }
      }
  
      public AdapterNotification(Context mContext, List&lt;Notification&gt; items) {
          this.ctx = mContext;
          this.items = items;
          selected_items = new SparseBooleanArray();
          alphabetColor = new AlphabetColor(mContext);
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_notification, parent, false);
          return new ViewHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(final ViewHolder holder, final int position) {
          final Notification notification = items.get(position);
  
          // displaying text view data
  
          System.out.println("sender type:"+notification.sender_type);
          Character firstLetter;
          if(notification.sender_type.equals("1")) //Admin
          {
              String admin = ctx.getString(R.string.admin_name);
              holder.from.setText(admin);
              firstLetter = admin.substring(0, 1).charAt(0);
  
              holder.image_letter.setText(String.valueOf(firstLetter));
          }else
          {
              holder.from.setText(notification.senderName);
              firstLetter = notification.senderName.substring(0, 1).charAt(0);
              holder.image_letter.setText(String.valueOf(firstLetter));
          }
          if(notification.status.equals("unread"))
          {
              holder.from.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
              holder.title.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
          }
  
          holder.title.setText(notification.title);
          holder.message.setText(notification.message);
          holder.date.setText(getDate(Long.parseLong(notification.date)));
  
          holder.lyt_parent.setActivated(selected_items.get(position, false));
  
          holder.lyt_parent.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if (onClickListener == null) return;
                  onClickListener.onItemClick(v, notification, position);
              }
          });
  
          holder.lyt_parent.setOnLongClickListener(new View.OnLongClickListener() {
              @Override
              public boolean onLongClick(View v) {
                  if (onClickListener == null) return false;
                  onClickListener.onItemLongClick(v, notification, position);
                  return true;
              }
          });
  
          toggleCheckedIcon(holder, position);
          displayImage(holder, notification, firstLetter);
  
      }
  
      private void displayImage(ViewHolder holder, Notification notification, Character firstLetter) {
          if (notification.image != null) {
              Tools.displayImageRound(ctx, holder.image, notification.image);
              holder.image.setColorFilter(null);
              holder.image_letter.setVisibility(View.GONE);
          } else {
              holder.image.setImageResource(R.drawable.shape_circle);
              holder.image.setColorFilter(alphabetColor.getColorByAlphabet(firstLetter), PorterDuff.Mode.MULTIPLY);
              holder.image_letter.setVisibility(View.VISIBLE);
          }
      }
  
      private String getDate(long time) {
          Date date = new Date();
          long currentTime = date.getTime();
          String result = (String) DateUtils.getRelativeTimeSpanString(time, currentTime, 0);
          return result;
      }
  
  
  
      private void toggleCheckedIcon(ViewHolder holder, int position) {
          if (selected_items.get(position, false)) {
              holder.lyt_image.setVisibility(View.GONE);
              holder.lyt_checked.setVisibility(View.VISIBLE);
              if (current_selected_idx == position) resetCurrentIndex();
          } else {
              holder.lyt_checked.setVisibility(View.GONE);
              holder.lyt_image.setVisibility(View.VISIBLE);
              if (current_selected_idx == position) resetCurrentIndex();
          }
      }
  
      public Notification getItem(int position) {
          return items.get(position);
      }
  
      @Override
      public int getItemCount() {
          return items.size();
      }
  
      public void toggleSelection(int pos) {
          current_selected_idx = pos;
          if (selected_items.get(pos, false)) {
              selected_items.delete(pos);
          } else {
              selected_items.put(pos, true);
          }
          notifyItemChanged(pos);
      }
  
      public void clearSelections() {
          selected_items.clear();
          notifyDataSetChanged();
      }
  
      public int getSelectedItemCount() {
          return selected_items.size();
      }
  
      public List&lt;Integer&gt; getSelectedItems() {
          List&lt;Integer&gt; items = new ArrayList&lt;&gt;(selected_items.size());
          for (int i = 0; i &lt; selected_items.size(); i++) {
              items.add(selected_items.keyAt(i));
          }
          return items;
      }
  
      public void removeData(int position) {
          items.remove(position);
          resetCurrentIndex();
  
  
      }
  
      private void resetCurrentIndex() {
          current_selected_idx = -1;
      }
  
      public interface OnClickListener {
          void onItemClick(View view, Notification obj, int pos);
  
          void onItemLongClick(View view, Notification obj, int pos);
      }
  }
  </code></pre>