RatingBar average
<p>On my app I want users to be able to rate an item using the given ratings bar (1-5 stars) and then display the average of all the ratings in a textview. I also need it to keep up with the number of people that have rated it. A perfect example of what I am looking for is in the android marketplace when people rate apps,  except im not rating an entire app just an item within my app(a movie for example). I have the xml layout but i'm not exactly sure how to get started in java. Thanks in advance.</p>

<p>a short example: say i wanted users to rate movies.(1) They open my app see the list of movies under menu. (2) click on a movie, see the average rating from everyone else and how many ratings in total.(3) use the ratingbar to add their own rating then submit. </p>

<p>It wouldnt let me post a picture but here is exactly what i'm looking for but without the bar graph part. <a href="http://www.google.com/imgres?hl=en&amp;sa=X&amp;tbo=d&amp;biw=1192&amp;bih=541&amp;tbm=isch&amp;tbnid=8FX_Hs_4RcWEdM%3a&amp;imgrefurl=http://readwrite.com/2011/06/27/Google-tweaks-android-market-ratings-system&amp;docid=Aw9unSV9rzbm2M&amp;imgurl=http://readwrite.com/files/files/files/mobile/android_market_ratings-1.jpg&amp;w=507&amp;h=182&amp;ei=kEXCUPybEJL5rAH594GICw&amp;zoom=1&amp;iact=rc&amp;dur=285&amp;sig=104004368297077878175&amp;page=3&amp;tbnh=99&amp;tbnw=261&amp;start=38&amp;ndsp=23&amp;ved=1t:429,r:39,s:0,i:210&amp;tx=147&amp;ty=75" rel="nofollow">average rating</a></p>

<p>xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" &gt;

&lt;TextView
    android:id="@+id/tv1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginTop="40dp"
    android:text="TextView"
    android:textSize="50dp" /&gt;

&lt;TextView
    android:id="@+id/tv2"
    android:layout_width="wrap_content"
    android:layout_gravity="center"
    android:layout_height="wrap_content"
    android:text="TextView" /&gt;

&lt;RatingBar
    android:id="@+id/ratingBar1"
    android:layout_width="wrap_content"
    android:layout_marginTop="40dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"/&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>Java:</p>

<pre><code>public class MainActivity extends Activity {

RatingBar ratings;
TextView tv1, tv2;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.menu);
}
}
</code></pre>
