Android ListView Crach

时间:2019-02-24 23:36:39

标签: android listview

创建底部导航栏并创建此功能之后

fun createFragmentOne(){
    var brandsUrl = "URL"
    var brandList =  ArrayList<String>()
    var requestQ = Volley.newRequestQueue(this@HomePage)
    var jsonArr = JsonArrayRequest(Request.Method.GET,brandsUrl,null, Response.Listener {

            response ->
        for (jsonBj in 0.until(response.length())){
            brandList.add(response.getJSONObject(jsonBj).getString("brand"))
        }
           var brandsListAdapter = ArrayAdapter(this@HomePage,android.R.layout.simple_list_item_1,brandList)
        val dialogBuilder = AlertDialog.Builder(this@HomePage)
        dialogBuilder.setMessage(brandsListAdapter.)
        dialogBuilder.create().show()
           vw1.adapter = brandsListAdapter


    }, Response.ErrorListener {

            error ->
        val dialogBuilder = AlertDialog.Builder(this)
        dialogBuilder.setMessage(error.message)
        dialogBuilder.create().show()

    })

    requestQ.add(jsonArr)
    val transaction  = manager.beginTransaction()
    val fragment = FirstFragment()
    transaction.replace(R.id.fragmentHolder,fragment)
    transaction.addToBackStack(null)
    transaction.commit()
}

我使用底部导航栏切换片段,并且仅在第一个片段listview上单击“第一”时显示,但是我单击导航栏列表上的同一项目已禁用或再次变为白色。

0 个答案:

没有答案