Android的HttpURLConnection类 [英] Android HttpUrlConnection

查看:137
本文介绍了Android的HttpURLConnection类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新Android开发,我观察到的HttpClient已经去$ P $在API 22 pcated。后来我发现,HttpURLConnection类是由Android.I支持搜索很多教程,但我不能找到解决方案发送张贴JSON格式参数的PHP脚本。指导我解决这个问题的方法。

I am new to Android development and I observed that HttpClient has been deprecated in API 22 .then I found that HttpUrlConnection is supported by Android.I searched for many tutorials but I am not able to find solution for sending post parameters in JSON format to a PHP script . Guide me the way to solve that problem.

推荐答案

虽然这可能是一个好主意HttpURLConnection类做一次或两次,了解输入和OutputStream的,但我肯定会推荐的库,例如< A HREF =htt​​ps://github.com/square/okhttp相对=nofollow> okhttp 或的改装,因为它是更痛苦的长期

Although it might be a good idea to do it with HttpURLConnection once or twice to learn about the Input- and Outputstream but I would definitely recommend a library such as okhttp or retrofit because it's much less painful longterm.

这篇关于Android的HttpURLConnection类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆