title: Delete Single Item in Firebase Database with Android Generated by Push()
body: <p>I haven't been able to find a clear answer that helped me delete a node that has been added as a POJO, and then given a key generated by push(). All I'm trying to do is delete a given item when it's being long pressed on a listview. I've tried removeValue() but all that does is delete the whole parent node as well, which isn't what I wanted. I don't know how to get the generated key.</p>
  
  <p>Could you provide an example of getting a reference say /node/ so that I can use <strong>.removeValue()</strong> on that inside a listview. My issue is I'm trying to grab the proper pushed key in the list so that I can reference that key under /nodes and then delete that one singular item instead of the entire nodes reference which is what <strong>mDatabase.child("nodes").removeValue()</strong> does currently. When I want something like <strong>mDatabase.child("nodes").child(pushedKey).removeValue()</strong>.</p>
  
  <p>when i send data to nodes it looks like this. </p>
  
  <pre><code>mDatabase.child("nodes").push().setValue(POJO); 
  </code></pre>
  
  <p>I'm using this to delete it...</p>
  
  <pre><code> main_ListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              //Delete node
              listAdapter.mNodes.remove(position);
              mDatabase.child("nodes").push().getRef().removeValue();
              listAdapter.setNotifyOnChange(true);
              Toast.makeText(getApplicationContext(),"Removed Item at: " + position,Toast.LENGTH_SHORT).show();
              main_ListView.setAdapter(listAdapter);
              return true;
          }
      });
  </code></pre>
  
  <p><strong>example</strong></p>
  
  <p><a href="https://i.stack.imgur.com/nZufM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nZufM.png" alt="enter image description here"></a></p>
  
  <p>Any help would be grateful thanks. :)</p>