title: Retrieving data from firebase to android studio using kotlin depending on text value
body: <p>how to get the id of data retrieved from the firebase so I can limit the data being retrieved from the firebase depending on the id.</p>
  
  <p>here is my current code, it retrieves all the data from child "beetle" on my firebase database, I want to limit that so it will show only 1 data depending on what the id is.</p>
  
  <pre><code>    lateinit var listView: ListView
  lateinit var ref: DatabaseReference
  lateinit var beetleList:MutableList&lt;Beetle&gt;
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_classify)
  
      val capturedImage = intent.extras.getParcelable("captured_image") as Bitmap?
      val beetleName=intent.getStringExtra("Beetle")
  
  
      imageCaptured2.setImageBitmap(capturedImage)
      textBeetleName.setText(beetleName)
  
      listView = findViewById(R.id.beetle_list)
      beetleList = mutableListOf()
      ref = FirebaseDatabase.getInstance().getReference("beetle")
  
      ref.addValueEventListener(object : ValueEventListener{
          override fun onCancelled(p0: DatabaseError) {
  
          }
  
          override fun onDataChange(p0: DataSnapshot) {
              if(p0!!.exists()){
                  beetleList.clear()
                  for (e in p0.children){
                      val beetle = e.getValue(Beetle::class.java)
                      beetleList.add(beetle!!)
                  }
                  val adapter = BeetleCardAdapter(this@classify,R.layout.beetle_card_item,beetleList)
                  listView.adapter = adapter
              }
          }
      })
  </code></pre>
  
  <p>here is my firebase structure:</p>
  
  <p><a href="https://i.stack.imgur.com/X762j.png" rel="nofollow noreferrer">firebase database</a></p>