title: Passing data from fragment to activity android
body: <p>I am trying to pass a String from a fragment to an activity in my app.I dont know what I am doing wrong but it seems the activity is not receiving the Intent that is being sent.THis is my code</p>
  
  <p>Fragment  (tab2.class)</p>
  
  <pre><code>final String key = getRef(position).getKey();
  
                          viewHolder.setUsername(model.getUsername());
                          viewHolder.setDownloadUrl(getActivity().getApplicationContext(), model.getDownloadUrl());
                          viewHolder.mView.setOnClickListener(new View.OnClickListener() {
                              @Override
                              public void onClick(View view) {
  
  
                                  Intent chatIntent = new Intent(getActivity(), Chat.class);
                                  chatIntent.putExtra("key",key);
                                  startActivity(chatIntent);
                                  Log.v("intent", key);
  </code></pre>
  
  <p>Chat Activity(Chat.class)</p>
  
  <pre><code>Intent chatIntent = getIntent();
          String key = chatIntent.getStringExtra("key");
          Log.v("intents", key);
  </code></pre>