use of com.novoda.model.SearchResponse in project android-demos by novoda.
the class JsonRequest method onResume.
@Override
protected void onResume() {
super.onResume();
Toast.makeText(this, "Querying droidcon on Twitter", Toast.LENGTH_SHORT).show();
Reader reader = new InputStreamReader(retrieveStream(url));
SearchResponse response = new Gson().fromJson(reader, SearchResponse.class);
List<String> searches = new ArrayList<String>();
Iterator<Result> i = response.results.iterator();
while (i.hasNext()) {
Result res = (Result) i.next();
searches.add(res.text);
}
ListView v = (ListView) findViewById(R.id.list);
v.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, searches.toArray(new String[searches.size()])));
}
Aggregations