Reputation: 492
I created a piechart view with help of Android Developer site. I also store my survey results on my MySQL database. My JSON output is like this:
{"results":[{"CandidateNo":"110","VoteCount":"3"},{"CandidateNo":"1124","VoteCount":"1"}]}
In Android, I used this to getting results.
for (int i = 0; i < result.length(); i++) {
JSONObject c = sonuc.getJSONObject(i);
String CandidateNo = c.getString(TAG_NO);
String Result = c.getString(TAG_RESULT);
pie.addItem(TAG_NO,TAG_RESULT, color);
}
addItem method is like this:
public int addItem(String label, float value, int color)
So the result value is float. But my TAG_RESULT is String. So it doesn't accept. What should i do about this, is my approach wrong?
Upvotes: 0
Views: 158