title: How to assign Rating value in Ratingbar in android?
body: <p>I need to give rating for a product where everything comes dynamically.</p>
  
  <pre><code>    String rating = i.getStringExtra("Rating"); // the output of string is 8.6
  
      RatingBar txtrating = (RatingBar)findViewById(R.id.rating);
       txtrating.setRating(Float.parseFloat(rating));
  </code></pre>
  
  <p>This gives 29 stars rated fully. But i need to give 10 stars where 8.6 should be assigned.</p>
  
  <p>xml is as follows:</p>
  
  <pre><code>&lt;RatingBar
          android:id="@+id/rating"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          style="?android:attr/ratingBarStyleSmall"
          android:numStars="10" // don't know why many stars are reproducing.
          android:isIndicator="true" /&gt;
  </code></pre>