use of cz.msebera.android.httpclient.client.methods.HttpGet in project cw-omnibus by commonsguy.
the class LoadThread method run.
@Override
public void run() {
try {
HttpClient client = HttpClientBuilder.create().setConnectionManager(new PoolingHttpClientConnectionManager()).build();
HttpGet get = new HttpGet(SO_URL);
try {
String result = client.execute(get, new BasicResponseHandler());
SOQuestions questions = new Gson().fromJson(result, SOQuestions.class);
EventBus.getDefault().post(new QuestionsLoadedEvent(questions));
} catch (IOException e) {
Log.e(getClass().getSimpleName(), "Exception parsing JSON", e);
}
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "Exception parsing JSON", e);
}
}
Aggregations