TheUnreal
TheUnreal

Reputation: 24492

Android Studio Apache functions

I've been trying to create DefaultHttpClient object with:

HttpClient client = new DefaultHttpClient();

but I'm unable to find this class can't be resolved in my Android Studio. After googling this class, the first result shows the following URL:Link

and it's 404: not found page.

Does anyone know how I can use this function and similar function such as HttpGet?

Upvotes: 2

Views: 52

Answers (1)

Peanuts
Peanuts

Reputation: 352

Use urlconnection. If i remember correctly, defaulthttpclient is deprecated.

URL url = new URL("http://stackoverflow.com");
URLConnection conn = url.openConnection();
InputStream in = new BufferedInputStream(conn.getInputStream());

Upvotes: 1

Related Questions