I’m Playing around in android and right now i added rating bars to a list view, the bars actual rating comes by from a server resposnse which is then stored into a arraylist which is then should be sent to the list view with dataadapter. problem is I don’t know how to inflate the rating bar on run time by the response given, ideas?
heres my code:
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all score
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
BusinessActivity.this, businessArrayList,
R.layout.business_list_item, new String[] { TAG_NAME, TAG_EMAIL, TAG_SCORE },
new int[] { R.id.player_name, R.id.player_email, R.id.player_rating });
// updating listview
setListAdapter(adapter);
}
});
}
}
RatingBar value can be easily set by passing the value to the method setRating()