Android 如何通过服务器响应在列表视图中设置分级栏

Android 如何通过服务器响应在列表视图中设置分级栏,android,ratingbar,Android,Ratingbar,我在android中玩,现在我在列表视图中添加了评级条,实际评级条来自服务器响应,然后存储到arraylist中,然后通过dataadapter发送到列表视图。问题是,我不知道如何通过给出的响应来扩大运行时的评级栏,想法? 这是我的密码: /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(String file_url) { //

我在android中玩,现在我在列表视图中添加了评级条,实际评级条来自服务器响应,然后存储到arraylist中,然后通过dataadapter发送到列表视图。问题是,我不知道如何通过给出的响应来扩大运行时的评级栏,想法? 这是我的密码:

/**
 * 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);
               }
          });

      }     
  }

通过将值传递给方法setRating()可以轻松设置RatingBar值


设置在我的情况下没有效果
RatingBar rb=(RatingBar)findViewById(R.id.ratingBar);
/*
*After you get response from server, assuming String serverResponse contains the value.
*/
rb.setRating(Float.parseFloat(serverResponse));