我使用Json检索LatLong值,然后我将这些值保存在LatLang对象中,现在我想在toast中显示,以确保保存值
for (int i = 0; i < matchFixture.length(); i++) {
JSONObject c = matchFixture.getJSONObject(i);
Double matchId = Double.valueOf(c.getString(TAG_Latitude));
Log.d("matchId", String.valueOf(matchId));
Double teamA = Double.valueOf(c.getString(TAG_Longitude));
Log.d("teamA", String.valueOf(teamA));
// hashmap for single match
matchFixtures = new HashMap<String, String>();
// adding each child node to HashMap key => value
matchFixtures.put(TAG_Latitude, String.valueOf(matchId));
matchFixtures.put(TAG_Longitude, String.valueOf(teamA));
matchFixtureList.add(matchFixtures);
latLng=new LatLng(matchId,teamA);
System.out.print("herejj"+latLng);
}
答案 0 :(得分:1)
Toast.makeText(getApplicationContext(), "Long: " + String.valueOf(matchId) + ", Lat: " + String.valueOf(teamA), Toast.LENGTH_SHORT).show();