Skip to content

Commit 8db120b

Browse files
committed
More javadoc comments
1 parent dfd4bd9 commit 8db120b

File tree

2 files changed

+47
-7
lines changed

2 files changed

+47
-7
lines changed

src/com/loopj/android/http/AsyncHttpResponseHandler.java

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,38 @@
3333

3434
/**
3535
* Used to intercept and handle the responses from requests made using
36-
* {@link AsyncHttpClient}.
36+
* {@link AsyncHttpClient}. The {@link #onSuccess(String)} method is
37+
* designed to be anonymously overridden with your own response handling code.
3738
* <p>
38-
* This class is designed to be passed to get, post, put and delete requests
39-
* with the {@link #onSuccess(String)} method anonymously overridden.
40-
* <p>
41-
* Optionally, you can also override the {@link #onFailure(Throwable)},
39+
* Additionally, you can override the {@link #onFailure(Throwable)},
4240
* {@link #onStart()}, and {@link #onFinish()} methods as required.
41+
* <p>
42+
* For example:
43+
* <p>
44+
* <pre>
45+
* AsyncHttpClient client = new AsyncHttpClient("My User Agent");
46+
* client.get("http://www.google.com", new AsyncHttpResponseHandler() {
47+
* &#064;Override
48+
* public void onStart() {
49+
* // Initiated the request
50+
* }
51+
*
52+
* &#064;Override
53+
* public void onSuccess(String response) {
54+
* // Successfully got a response
55+
* }
56+
*
57+
* &#064;Override
58+
* public void onFailure(Throwable e) {
59+
* // Response failed :(
60+
* }
61+
*
62+
* &#064;Override
63+
* public void onFinish() {
64+
* // Completed the request (either success or failure)
65+
* }
66+
* });
67+
* </pre>
4368
*/
4469
public class AsyncHttpResponseHandler {
4570
private static final int SUCCESS_MESSAGE = 0;

src/com/loopj/android/http/RequestParams.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,23 @@
3434
import org.apache.http.message.BasicNameValuePair;
3535

3636
/**
37-
* A collection of string request parameters or files to send along with HTTP
38-
* GET, POST or PUT requests made with {@link AsyncHttpClient}.
37+
* A collection of string request parameters or files to send along with
38+
* requests made from an {@link AsyncHttpClient} instance.
39+
* <p>
40+
* For example:
41+
* <p>
42+
* <pre>
43+
* RequestParams params = new RequestParams();
44+
* params.put("username", "james");
45+
* params.put("password", "123456");
46+
* params.put("email", "my&#064;email.com");
47+
* params.put("profile_picture", new File("pic.jpg")); // Upload a File
48+
* params.put("profile_picture2", someInputStream); // Upload an InputStream
49+
* params.put("profile_picture3", new ByteArrayInputStream(someBytes)); // Upload some bytes
50+
*
51+
* AsyncHttpClient client = new AsyncHttpClient("My User Agent");
52+
* client.post("http://myendpoint.com", params, responseHandler);
53+
* </pre>
3954
*/
4055
public class RequestParams {
4156
private static String ENCODING = "UTF-8";

0 commit comments

Comments
 (0)