-1

I am newbie in networking side and want to learn how LoopJ AndroidAsyncHttp works,i have got project downloaded and got it working after building. Now i am loogkin for any links or tutorials for LoopJ AndroidAsyncHttp to get basic idea before i could start going through the project code.

m also learning android so its difficult for me to understand the code without knowing the basics.

Please guide me to opt for better approach to understand it.

my working project is :https://github.com/loopj/android-async-http

Stephane Landelle
  • 6,990
  • 2
  • 23
  • 29
Pratswinz
  • 1,476
  • 11
  • 24

2 Answers2

0

Use OkHttp.

 Let me show a simple example.

import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;

public class GetExample {
OkHttpClient client = new OkHttpClient();

String run(String url) throws IOException {
Request request = new Request.Builder()
    .url(url)
    .build();

Response response = client.newCall(request).execute();
return response.body().string();
}

 public static void main(String[] args) throws IOException {
 GetExample example = new GetExample();
 String response =    example.run("https://raw.github.com/square/okhttp/master/README.md");
 System.out.println(response);
 }
}
Shadow
  • 6,864
  • 6
  • 44
  • 93
0

Like NaviRamyle has said, you could use Retrofit as a solution for your Async HTTP requests. Also, take a look at Google's Volley. A nice example/tutorial that made me use and enjoy Volley was Androidhive's basic Volley tutorial :

http://www.androidhive.info/2014/05/android-working-with-volley-library-1/

By default all requests are asynchronous and managed by a callback architecture that you can easily implement on your application.

Best regards,

Ricardo Vieira
  • 1,738
  • 1
  • 18
  • 26
  • While this may answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – IKavanagh Sep 25 '15 at 09:47