How to make an API request in Kotlin?

前端 未结 4 1966
悲哀的现实
悲哀的现实 2021-01-31 15:29

I am extremely new to Kotlin and APIs in general and can\'t find the syntax to create an API request using this language. I am creating a mobile version of a website so I\'m usi

4条回答
  •  不思量自难忘°
    2021-01-31 15:42

    you can use Retrofit or AsyncTask , example of AsyncTask :

    class getData() : AsyncTask() {
        override fun doInBackground(vararg params: Void?): String? {
        }
    
        override fun onPreExecute() {
            super.onPreExecute()
        }
    
        override fun onPostExecute(result: String?) {
            super.onPostExecute(result)
        }
    }
    

    for Retrofit check this awsome tutorial

提交回复
热议问题