title: Display Rating Bar based on the number we retrieve from the database
body: <p><strong>MainActivity.java</strong></p>
  
  <pre><code>int averageRating = db.getUserRating(usersAddr);
  Log.d("rating value",""+averageRating); 
  TextView view = (TextView) findViewById(R.id.rating);
  view.setText("Rating:"+averageRating);
  ll = (LinearLayout)findViewById(R.id.ll);
  </code></pre>
  
  <p><strong>Databasehelper.java</strong></p>
  
  <pre><code>public int getUserRating(String userMac)
  {
  int avgRating = 0 ;
  String selectQuery = "SELECT AVG(rate) as average FROM " + TABLE_RATING + " WHERE "
          + KEY_RECEIVERID + "='" + userMac+"'";
  
   SQLiteDatabase db = this.getReadableDatabase();
  Cursor cursor = db.rawQuery(selectQuery, null);
  
  if (cursor!= null)
  {
          if (cursor.moveToFirst()) {
          Log.d("CURSOR POSITION",  ""+cursor.getPosition());
          avgRating = cursor.getInt((cursor.getPosition()));
          Log.d("average", ""+cursor.getInt((cursor.getPosition())));
          System.out.println(cursor.getInt((cursor.getPosition())));
      }
  }
  return avgRating;
  }
  </code></pre>
  
  <p><strong>XML file</strong></p>
  
  <pre><code>&lt;LinearLayout
    android:id="@+id/ll"
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" &gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the code for retrieving the average rating from the database.I am displaying it as a text.But i want to display the rating in the form of rating bar.Can you help me?</p>