I have created Kotlin Code with static values:
I wanted to know how can I create the same with jetpack compose? I don't know
Code:
class TestApp : AppCompatActivity() {
var listAdapter: ExpandableListAdapter? = null
var expListView: ExpandableListView? = null
var listDataHeader: MutableList<String>? = null
var listDataChild: HashMap<String, List<String>>? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
expListView = findViewById<View>(R.id.lvExp) as ExpandableListView
prepareListData()
listAdapter = ExpandableListAdapter(this, listDataHeader, listDataChild)
expListView!!.setAdapter(listAdapter)
}
private fun prepareListData() {
listDataHeader = ArrayList()
listDataChild = HashMap()
listDataHeader?.add(getString(R.string.q_1))
val on_0: MutableList<String> = ArrayList()
on_0.add(getString(R.string.faq_d_0))
listDataChild!![listDataHeader!![0]] = on_0
}
}