title: How to get SharedPreferences float value in RecyclerView Adapter?
body: <p>I am using this SharedPref Class for saving and retrieving value from it. Here I created setTextSize &amp; getTextSize methods.</p>
  <p><strong>SharedPref.java</strong></p>
  <pre><code>
  public class SharedPref {
              SharedPreferences mySharedPref;
              float aFloat = 18.0f;
  
      // this method will save the text size
      public void setTextSize(float tSize) {
          SharedPreferences.Editor editor = mySharedPref.edit();
          editor.putFloat(&quot;TextSize&quot;,tSize);
          editor.apply();
      }
      
      // this method will get the text size
      public float getTextSize (){
          return mySharedPref.getFloat(&quot;TextSize&quot;,aFloat);
      }
  }
  
  </code></pre>
  <p>Now I want to call getTextSize method in RecyclerView Adapter for set text size.</p>
  <p><strong>NameAdapter.java</strong></p>
  <pre><code>public class NameAdapter extends RecyclerView.Adapter&lt;NameAdapter.NameViewHolder&gt; implements Filterable {
  
      Context context;
      List&lt;NameModel&gt; nameItemList;
  
      public NameAdapter(@NonNull Context context, List&lt;NameModel&gt; nameItemList) {
          this.context = context;
          this.nameItemList = nameItemList;
      }
  
      @NonNull
      @Override
      public NameViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
  
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.name_item,parent, false );
          return new NameViewHolder(view);
      }
  
      @Override
      public void onBindViewHolder(@NonNull NameViewHolder holder, int position) {
  
          holder.name.setText(nameItemList.get(position).getName());
          holder.meaning.setText(nameItemList.get(position).getMeaning());
  
          // here I want to use setTextSize method from SharedPref
          holder.name.setTextSize(getTextSize);
      }
  
      @Override
      public int getItemCount() {
          return nameItemList.size();
      }
  
        public class NameViewHolder extends RecyclerView.ViewHolder{
  
          TextView name,meaning;
  
          public NameViewHolder(View itemView) {
              super(itemView);
              name = (TextView) itemView.findViewById(R.id.tvName);
              meaning = (TextView) itemView.findViewById(R.id.tvMeaning);
  
          }
      }
  
  }
  
  </code></pre>
  <p><strong>Please help. Thanks in advance.</strong></p>