content: package com.melnykov.fab.sample;
  
  import android.content.Context;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> {
      private final Context mContext;
      private final String[] mDataset;
  
      public RecyclerViewAdapter(Context context, String[] dataset) {
          mContext = context;
          mDataset = dataset;
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          TextView view = (TextView) LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
          return new ViewHolder(view);
      }
  
      @Override
      public void onBindViewHolder(ViewHolder viewHolder, int position) {
          String[] values = mDataset[position].split(",");
          String countryName = values[0];
          int flagResId = mContext.getResources().getIdentifier(values[1], "drawable", mContext.getPackageName());
          viewHolder.mTextView.setText(countryName);
          viewHolder.mTextView.setCompoundDrawablesWithIntrinsicBounds(flagResId, 0, 0, 0);
      }
  
      @Override
      public int getItemCount() {
          return mDataset.length;
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder {
          public TextView mTextView;
  
          public ViewHolder(TextView v) {
              super(v);
              mTextView = v;
          }
      }
  }