title: Firebase get data using key value
body: <p>I am developing an list app with FirebaseListAdapter. I'm having problem with the getKey() value. I want to access the data under the listitem that is been clicked and display it in the textview from another activity. But ican't figure out what to do ?</p>
  
  <p>Here's what my code looks like now </p>
  
  <pre><code>   myList.setAdapter(myAdapter);
      myList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              Story st = (Story)parent.getItemAtPosition(position);
              String stry = st.Story;
              Toast.makeText(MainActivity.this, ""+stry,Toast.LENGTH_LONG).show();
  
              Intent intent = new Intent(context, MyStoryActivity.class);
              intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              Bundle bundle = new Bundle();
              bundle.putString("Story", stry);
              intent.putExtras(bundle);
              context.startActivity(intent);
          }
      });
  }
  </code></pre>
  
  <p>I'm getting the story value of the last added story when I clicked on any of the list item.</p>
  
  <p>Here's the code of another activity where I want to display the value of the Story.</p>
  
  <pre><code>  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.story_view);
  
      database = FirebaseDatabase.getInstance();
      ref = database.getReference("Stories");
      ttl = (TextView) findViewById(R.id.title);
      stry = (TextView) findViewById(R.id.story);
      Bundle bundle = getIntent().getExtras();
      stry1 = bundle.getString("Story");
  
  
  
      ref.addChildEventListener(new ChildEventListener() {
          @Override
          public void onChildAdded(DataSnapshot dataSnapshot, String s) {
              Story ad = dataSnapshot.getValue(Story.class);
  
                  ttl.setText(ad.Title);
                  stry.setText(stry1);
          }
  
          @Override
          public void onChildChanged(DataSnapshot dataSnapshot, String s) {
  
          }
  
          @Override
          public void onChildRemoved(DataSnapshot dataSnapshot) {
  
          }
  
          @Override
          public void onChildMoved(DataSnapshot dataSnapshot, String s) {
  
          }
  
          @Override
          public void onCancelled(DatabaseError databaseError) {
  
          }
      });
  
  }
  </code></pre>
  
  <p>This is what my database looks like
  <a href="https://i.stack.imgur.com/cxBFn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cxBFn.jpg" alt="enter image description here"></a></p>
  
  <p>Here is the Story.class</p>
  
  <pre><code>public class Story {
  
  public String Title;
  public String Story;
  
  // Default constructor required for calls to
  // DataSnapshot.getValue(User.class)
  public Story() {
  }
  
  public Story(String ttl, String stry) {
      this.Title = ttl;
      this.Story = stry;
  }}
  </code></pre>