OkHttp in android for making network requests

前端 未结 8 1578
北海茫月
北海茫月 2020-12-29 08:18

What I am trying to do::

I am trying to learn the usage of Okhttp for making networking calls in android


What I have done

相关标签:
8条回答
  • 2020-12-29 09:18

    You need declare client variable like this:

    OkHttpClient client = new OkHttpClient();
    

    Also you should use your request using some thread or AsyncTask!

    You can read something else about AsyncTask on Android in this link: http://androidresearch.wordpress.com/2012/03/17/understanding-asynctask-once-and-forever/

    0 讨论(0)
  • 2020-12-29 09:19

    Try adding internet permissions in your manifest file?

    <uses-permission android:name="android.permission.INTERNET" />
    
    0 讨论(0)
提交回复
热议问题