How to I read SharedPreferences value from another activity?
how to i read Preferences from other activities?
public class PickupGroupListAdaper extends RecyclerView.Adapter<PickupGroupListAdaper.ViewHolder>{
private ArrayList<GroupListItems> groupListItemsArrayList;
//Create new views (invoked by the layout manager)
@Override
public PickupGroupListAdaper.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//Creating a new view
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.pickup_group_list,parent,false);
//set the view's size, margins, paddings and layout parameters
ViewHolder vh = new ViewHolder(v);
return vh;
}
//Replace the contents of a view (invoked by the layout manager
@Override
public void onBindViewHolder(PickupGroupListAdaper.ViewHolder holder, int position) {
// - get element from arraylist at this position
// - replace the contents of the view with that element
GroupListItems groupListItems = groupListItemsArrayList.get(position);
holder.tv_group_player_email.setText(groupListItems.getPlayer_email());
}
@Override
public int getItemCount() {
return groupListItemsArrayList.size();
}
//Provide a reference to the views for each data item
//Complex data items may need more than one view per item, and
//you provide access to all the views for a data item in a view holder
public class ViewHolder extends RecyclerView.ViewHolder {
//each data item is just a string in this case
public TextView tv_group_player_email;
public ViewHolder(View itemView) {
super(itemView);
tv_group_player_email = (TextView)itemView.findViewById(R.id.tv_group_player_email);
}
}
public PickupGroupListAdaper(ArrayList<GroupListItems> groupListItemsArrayList) {
this.groupListItemsArrayList = groupListItemsArrayList;
}
}