title: Android populate arrayOf with firebase data rather than strings
body: <p>I am new to firebase, so some things are still a bit confusing to me.</p>
  
  <p>I have an array: <code>var spinnerArray = arrayOf("Dumbell", "Punching Bag", "Yoga Ball", "Skipping Rope")</code>
  which I then pass to a spinner. All that is working. Although, now I want to take it to the next level, which is instead of populating the spinner with the strings I added to the array, I want it to pass the data I have on my firebase database. Reason is, some items have subitems, so I need to use objects instead.</p>
  
  <p>I really don't know how to go around and replace this.
  Could you please help me</p>
  
  <p>I have already my app connected to the realtime database.</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <pre><code>  {
    "KitList" : {
      "kettle" : {
        "10KG" : "10KG",
        "5KG" : "5KG"
      },
      "punchBag" : "punch bag",
      "sandbag" : "sandbag"
    }
  }
  </code></pre>
  
  <p>Someone told me I shouldn't have the value equal to the key? </p>
  
  <hr>
  
  <p>This is my model</p>
  
  <pre><code>class KitList(val title: String) {
  
  override fun toString(): String {
      return super.toString()
  }}
  </code></pre>
  
  <hr>
  
  <p>This is the activity where the spinner is:</p>
  
  <pre><code>class NewKitListActivity : AppCompatActivity() {
  var database = FirebaseDatabase.getInstance()
  var myRef = database.getReference("KitList")
  
  
  
  var spinnerArray = arrayOf("Dumbell", "Punching Bag", "Yoga Ball", "Skipping Rope")
  
  inner class Item {
      var IdItem: Int = 0
      var Item: String? = null
      var SubItems: ArrayList&lt;Item&gt;? = null
  }
  
  var newKitList = mutableListOf&lt;String&gt;()
  val selectedItems: MutableList&lt;String&gt;? = null
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_new_kit_list)
      var context = this;
      var addButton = addKitItemBtn
  
      val spinner = newKitItemSpinner
      val spinnerArrayAdapter = ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, spinnerArray)
      //selected item will look like a spinner set from XML
      spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
      spinner.adapter = spinnerArrayAdapter
  
      val kitList = newKistListView
      val listViewAdapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, newKitList)
      kitList.adapter = listViewAdapter
  
      addButton.setOnClickListener(object : View.OnClickListener {
          override fun onClick(v: View?) {
              val selectedItem = spinner.selectedItem.toString()
              newKitList.add(selectedItem)
              listViewAdapter.notifyDataSetChanged()
          }
      })}}
  </code></pre>