How do I send data from fragment to another activity : <p>In my app, i have an activity that have recyclerview inside a fragment and the recycleview retrieve data from cloud store Firebase. I want to open new activity that will retrieve the data according to the link(that display on the recycler view) user has clicked. 
How do i get the data and display it in new activity?</p>

<p>From ForumTitle.java > Show ReviewFragment.java > User click a value > Show ForumInterface.java</p>

<p>ForumTitle.java</p>

<pre><code>public class ForumTitle extends AppCompatActivity {
    private FirebaseFirestore db = FirebaseFirestore.getInstance();


    ImageButton IVReview,IVTechnical,IVHardware;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forum_title);

        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Fragment selectedFragment = null;
                if (v == findViewById(R.id.iBReview)){
                    selectedFragment = new ReviewFragment();
                }
                else if (v == findViewById(R.id.iBTech)){
                    selectedFragment = new TechnicalSupportFragment();
                }
                else if (v == findViewById(R.id.iBHardware)){
                    selectedFragment = new HardwareFragment();
                }
                FragmentManager manager = getSupportFragmentManager();
                FragmentTransaction transaction = manager.beginTransaction();
                transaction.replace(R.id.fragment_container,selectedFragment);
                transaction.commit();
            }

        };
        IVReview = (ImageButton)findViewById(R.id.iBReview);
        IVTechnical = (ImageButton)findViewById(R.id.iBTech);
        IVHardware = (ImageButton)findViewById(R.id.iBHardware);
        IVReview.setOnClickListener(listener);
        IVTechnical.setOnClickListener(listener);
        IVHardware.setOnClickListener(listener);
    }
}
</code></pre>

<p>ReviewFragment.java</p>

<pre><code>public class ReviewFragment extends Fragment {
    private FirebaseFirestore db = FirebaseFirestore.getInstance();
    private CollectionReference userRef = db.collection("Review");
    private ForumAdapter adapter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view =  inflater.inflate(R.layout.fragment_review,container,false);
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        Query query = userRef.orderBy("DatePosted",Query.Direction.DESCENDING);
        FirestoreRecyclerOptions&lt;Forum&gt; options = new
                FirestoreRecyclerOptions.Builder&lt;Forum&gt;()
                .setQuery(query,Forum.class)
                .build();
        adapter = new ForumAdapter(options);
        RecyclerView recyclerView = (RecyclerView)view.findViewById(R.id.rvReview);
        recyclerView.setHasFixedSize(true);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this.getActivity());
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setAdapter(adapter);

        adapter.setOnItemClickListener(new ForumAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(DocumentSnapshot documentSnapshot, int position) {
                Forum forum = documentSnapshot.toObject(Forum.class);
                String title = forum.getTitle();
                String id = documentSnapshot.getId();
                Intent intent = new Intent(getActivity(), ForumInterface.class);
                Bundle extras = intent.getExtras();
                extras.putString("FORUM_TYPE","Review");
                extras.putString("FORUM_ID",id);
                extras.putString("TITLE",title);
                startActivity(intent);
            }
        });
    }

    @Override
    public void onStart() {
        super.onStart();
        adapter.startListening();
    }

    @Override
    public void onStop() {
        super.onStop();
        adapter.stopListening();
    }
</code></pre>

<p>ForumInterface.java</p>

<pre><code>public class ForumInterface extends AppCompatActivity {
    private FirebaseFirestore db = FirebaseFirestore.getInstance();
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    String forum_title = extras.getString("TITLE");
    String forum_type = extras.getString("FORUM_TYPE");
    String forum_id = extras.getString("FORUM_ID");
    private CollectionReference userRef = db.collection(forum_type).document(forum_id).collection(forum_title);
    private ForumAdapter adapter;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forum_interface);


        TextView test = (TextView)findViewById(R.id.tvForumTitle);
        test.setText(forum_title);
    }
}
</code></pre>

<p>ForumAdapter.java</p>

<pre><code>public class ForumAdapter extends FirestoreRecyclerAdapter&lt;Forum,ForumAdapter.ForumHolder&gt; {
    private OnItemClickListener listener;

    public ForumAdapter(FirestoreRecyclerOptions&lt;Forum&gt; options) {
        super(options);
    }

    @Override
    public void onBindViewHolder(ForumHolder forumHolder, int i, Forum forum) {
        forumHolder.textViewTitle.setText(forum.getTitle());
        forumHolder.textViewDescription.setText(forum.getDescription());
        forumHolder.timeStamp.setText(forum.getDatePosted().toString());
    }

    @NonNull
    @Override
    public ForumHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        android.view.View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardviewforumtitle,parent,false);
        return new ForumHolder(v);
    }
    class ForumHolder extends RecyclerView.ViewHolder{
        TextView textViewTitle;
        TextView textViewDescription;
        TextView timeStamp;
        public ForumHolder(View itemView) {
            super(itemView);
            textViewTitle = itemView.findViewById(R.id.title);
            textViewDescription = itemView.findViewById(R.id.description);
            timeStamp = itemView.findViewById(R.id.timestamp);

            textViewTitle.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    int position = getAdapterPosition();
                    // NO_POSITION to prevent app crash when click -1 index
                    if(position != RecyclerView.NO_POSITION &amp;&amp; listener !=null ){
                        listener.onItemClick(getSnapshots().getSnapshot(position),position);
                    }
                }
            });
        }
    }
    public interface OnItemClickListener{
        void onItemClick(DocumentSnapshot documentSnapshot, int position);
    }
    public void setOnItemClickListener(OnItemClickListener listener){
        this.listener = listener;
    }
    @Override
    public int getItemCount() {
        return super.getItemCount();
    }
}
</code></pre>

<p>With the code above i run it, i got an error</p>

<pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Bundle.putString(java.lang.String, java.lang.String)' on a null object reference

at my.edu.fsktm.um.finalproject.Fragment.ReviewFragment$1.onItemClick(ReviewFragment.java:61)
at my.edu.fsktm.um.finalproject.ForumTitle.ForumAdapter$ForumHolder$1.onClick(ForumAdapter.java:56)
</code></pre>

<p>The picture of my app
<a href="https://i.stack.imgur.com/9iw2z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9iw2z.png" alt="ForumTitle"></a></p>

<p><a href="https://i.stack.imgur.com/DItsr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DItsr.png" alt="ReviewFragment"></a></p>

<p>When I clicked the title "GTX 1660 Ti Gaming X"
<a href="https://i.stack.imgur.com/ovTDv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ovTDv.png" alt="Error message"></a></p>
