title: Android with Firebase : Trying to implement RecycleView with CardView but can't retrieve RecycleView item position?
body: <p>I'm a beginner, try to make a RecycleView layout with some information retrieve from Firebase database (in <code>MemberFragment.java</code>). In my code RecycleView layout with retrieve information from fire base database is worked but I can't retrieve item list position and can't be used for different massage display with different item list selected / clicked by user can any one help me how can I do it.
  my code is:-</p>
  
  <pre><code>package np.com.rotaractnepalapp;
  
  
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.v4.app.Fragment;
  import android.support.v7.app.AlertDialog;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.firebase.ui.database.FirebaseRecyclerAdapter;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  import com.squareup.picasso.Picasso;
  
  import np.com.rotaractnepalapp.Interface.ItemClickListener;
  import np.com.rotaractnepalapp.Model.Member;
  import np.com.rotaractnepalapp.ViewHolder.MemberViewHolder;
  
  public class MemberFragment extends Fragment {
  
      View memFragment;
      RecyclerView listofMembers;
  
      RecyclerView.LayoutManager memLayoutManger;
      FirebaseRecyclerAdapter&lt;Member, MemberViewHolder&gt; memAdapter;
  
      FirebaseDatabase database;
      DatabaseReference members;
  
      public static MemberFragment newInstance(){
          MemberFragment memberFragment = new MemberFragment();
          return memberFragment;
      }
  
      @Override
      public void onCreate(@Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          database = FirebaseDatabase.getInstance();
          members = database.getReference("ClubKNE");
      }
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          memFragment = inflater.inflate(R.layout.fragment_member,container,false);
  
          TextView title = (TextView) memFragment.findViewById(R.id.txtClubNameTitle);
          title.setText("RAC Kathmandu North-East");
  
          listofMembers = (RecyclerView) memFragment.findViewById(R.id.memLists);
          listofMembers.setHasFixedSize(true);
          memLayoutManger = new LinearLayoutManager(container.getContext());
          listofMembers.setLayoutManager(memLayoutManger);
  
          loadMember();
  
          return memFragment;
      }
  
      private void loadMember() {
          memAdapter = new FirebaseRecyclerAdapter&lt;Member, MemberViewHolder&gt;(
                  Member.class,
                  R.layout.mem_layout,
                  MemberViewHolder.class,
                  members
          ) {
              @Override
              protected void populateViewHolder(MemberViewHolder viewHolder, Member model, int position) {
                  viewHolder.memDesignation.setText(model.getMemDesignation());
                  viewHolder.memName.setText(model.getMemName());
                  viewHolder.memProfession.setText(model.getMemProfession());
                  viewHolder.memEmail.setText(model.getMemEmail());
                  Picasso.with(getActivity())
                          .load(model.getMemImage())
                          .into(viewHolder.memImage);
                  viewHolder.setItemClickListener(new ItemClickListener() {
                      @Override
                      public void onClick(View view, int position, boolean isLongClick) {
                          AlertDialog.Builder alertDialog = new AlertDialog.Builder(view.getContext());
                          LayoutInflater factory = LayoutInflater.from(view.getContext());
                          view = factory.inflate(R.layout.member_info_layout, null);
                          alertDialog.setView(view);
                          alertDialog.setNegativeButton("Done", new DialogInterface.OnClickListener() {
                              public void onClick(DialogInterface dialog, int which) {
                                  dialog.dismiss();
                              }
                          });
                          alertDialog.show();
  
                      }
                  });
              }
          };
          memAdapter.notifyDataSetChanged();
          listofMembers.setAdapter(memAdapter);
      }
  }
  </code></pre>