HttpClient class 已弃用

HttpClient class is deprecated

我正在我的 android 应用程序的注册页面上工作,我已经成功完成了,没有任何错误。但我有一个问题。一些 类 显示为已弃用。

            HttpClient httpClient = new DefaultHttpClient();
            HttpContext httpContext = new BasicHttpContext();

            HttpGet httpGet = new HttpGet(url);

            try {
                HttpResponse response = httpClient
                        .execute(httpGet, httpContext);

                InputStream inputStream = response.getEntity().getContent();

                input = (inputStreamToString(inputStream).toString())
                        .replaceAll("\s+", "");
            } catch (ClientProtocolException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

在这段代码中,HttpClient、HttpContext、HttpGet、HttpResponse、HttpClient、ClientProtocolException 显示为已弃用。这里面有什么问题吗?我如何在我的应用程序中使用最新的 类?

您可以使用 HttpURLConnection class 而不是检查 documentation