Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
example showing how to traverse chargepoint pojo
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
ChargePoint chargepoint = gson.fromJson(results.get(i).getJson(),
ChargePoint.class);
StationList slist = chargepoint.getStationList();
List<Summary> summaries = slist.getSummaries();
Summary summary = summaries.get(0);
long available = summary.getMapData().getLevel2().getPaid()
.getAvailable();
String toSpeak = available + "! " +
((available == 1) ? "charger is" : "chargers are") +
" available." + "This location is " + summary.getDescription();
Toast.makeText(getApplicationContext(), toSpeak.replace("!", ""),
Toast.LENGTH_LONG).show();
tts.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.