Skip to content

Commit 148b024

Browse files
committed
Update readme
1 parent 227ae34 commit 148b024

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

README.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,21 @@ How to Build a Basic Twitter Rest Client
5454
}
5555
}
5656

57+
5758
// Use the TwitterRestClient in your app
5859
import org.json.*;
5960
import com.loopj.android.http.*;
6061

6162
class TwitterRestClientUsage {
62-
public void getPublicTimeline() {
63+
public void getPublicTimeline() throws JSONException {
6364
TwitterRestClient.get("statuses/public_timeline.json", null, new JsonHttpResponseHandler() {
6465
@Override
65-
public void onSuccess(Object response) {
66-
JSONArray timeline = (JSONArray)response;
67-
68-
try {
69-
JSONObject firstEvent = timeline.get(0);
70-
String tweetText = firstEvent.getString("text");
66+
public void onSuccess(JSONArray response) {
67+
JSONObject firstEvent = timeline.get(0);
68+
String tweetText = firstEvent.getString("text");
7169

72-
// Do something with the response
73-
System.out.println(tweetText);
74-
} catch(JSONException e) {
75-
e.printStackTrace();
76-
}
70+
// Do something with the response
71+
System.out.println(tweetText);
7772
}
7873
});
7974
}

0 commit comments

Comments
 (0)