19
19
package com .loopj .android .http .sample ;
20
20
21
21
import android .util .Log ;
22
+
22
23
import com .loopj .android .http .AsyncHttpClient ;
23
24
import com .loopj .android .http .RequestHandle ;
24
25
import com .loopj .android .http .RequestParams ;
25
26
import com .loopj .android .http .ResponseHandlerInterface ;
26
- import java .util .Iterator ;
27
27
28
28
import org .apache .http .Header ;
29
29
import org .apache .http .HttpEntity ;
30
30
import org .json .JSONException ;
31
31
import org .json .JSONObject ;
32
32
33
+ import java .util .Iterator ;
34
+
33
35
/**
34
36
* This sample demonstrates how to upload JSON data using streams, resulting
35
37
* in a low-memory footprint even with extremely large data.
@@ -52,10 +54,10 @@ public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[]
52
54
JSONObject body ;
53
55
if (isRequestBodyAllowed () && (body = getBodyTextAsJSON ()) != null ) {
54
56
try {
55
- Iterator < String > keys = body .keys ();
57
+ Iterator keys = body .keys ();
56
58
Log .d (LOG_TAG , "JSON data:" );
57
59
while (keys .hasNext ()) {
58
- String key = keys .next ();
60
+ String key = ( String ) keys .next ();
59
61
Log .d (LOG_TAG , " " + key + ": " + body .get (key ));
60
62
params .put (key , body .get (key ).toString ());
61
63
}
@@ -64,7 +66,7 @@ public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[]
64
66
}
65
67
}
66
68
return client .post (this , URL , headers , params ,
67
- RequestParams .APPLICATION_JSON , responseHandler );
69
+ RequestParams .APPLICATION_JSON , responseHandler );
68
70
}
69
71
70
72
@ Override
@@ -88,7 +90,7 @@ protected JSONObject getBodyTextAsJSON() {
88
90
if (bodyText != null ) {
89
91
try {
90
92
return new JSONObject (bodyText );
91
- } catch (JSONException e ) {
93
+ } catch (JSONException e ) {
92
94
Log .e (LOG_TAG , "User's data is not a valid JSON object" , e );
93
95
}
94
96
}
0 commit comments