A
A
awox2022-02-14 22:30:47
Android
awox, 2022-02-14 22:30:47

Why does the code work on the second click of the button?

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val url = "https://www.cbr-xml-daily.ru/daily_json.js"
        val nameList = ArrayList<String>()
        rqbtn.setOnClickListener {
            val queue = Volley.newRequestQueue(this)
            val stringRequest = StringRequest(com.android.volley.Request.Method.GET, url,
                { response ->
                    nameList.add(response.substring(0, response.length))
                },
                { println("That didn't work!") })
            queue.add(stringRequest)
            rqview.adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, nameList)
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Razheny, 2022-02-18
@Razheny

Yes, everything is obvious right there, implement it yourself, I do not advise using something third-party.
https://library.vuforia.com everything is described here in the documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question