Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7721799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:01:03+00:00 2026-06-01T04:01:03+00:00

I am successful to parse JSON and display in listview. In list view I

  • 0

I am successful to parse JSON and display in listview.
In list view I displayed name, town and rating, which valued are already stored in database.
I want to display the rating bar instead of rating number there.
Also it should not support any user interaction, I mean I want to display rating bar only for information.
How can i do this ??
Help !!

        // Getting Array of Root
        root = json.getJSONArray(TAG_ROOT);

        // looping through All root
        for (int i = 0; i < root.length(); i++) {
            JSONObject c = root.getJSONObject(i);

            // Storing each json item in variable

            String name = c.getString(TAG_NAME);
            String town = c.getString(TAG_TOWN);
            String totalRating = c.getString(TAG_RATING);

            // creating new HashMap
            HashMap<String, String> map = new HashMap<String, String>();



                // adding each child node to HashMap key => value

                map.put(TAG_NAME, "Name: " + name);
                map.put(TAG_TOWN, "Town: " + town);
                map.put(TAG_RATING, "Rating: " + totalRating);

                // adding HashList to ArrayList
                myList.add(map);

        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

    /**
     * Updating parsed JSON data into ListView
     * */
    ListAdapter adapter = new SimpleAdapter(this, myList,
            R.layout.list_item, new String[] { TAG_NAME, TAG_TOWN,
                    TAG_RATING }, new int[] { R.id.name, R.id.address,
                    R.id.rating });

    setListAdapter(adapter);

list_item.xml

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:orientation="vertical" >

   <TextView
    android:id="@+id/name"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="2dip"
    android:paddingTop="6dip"
    android:textColor="#006fa8"
    android:textSize="16sp"
    android:textStyle="bold" />


   <TextView
    android:id="@+id/address"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="2dip"
    android:textColor="#acacac" >
   </TextView>

   <TextView
    android:id="@+id/rating"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="2dip"
    android:textColor="#acacac" >
 </TextView>  

 </LinearLayout>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:01:04+00:00Added an answer on June 1, 2026 at 4:01 am

    Hello Check below code

    <RatingBar 
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:isIndicator="true"
        android:numStars="5"
        android:stepSize="1"
        android:rating="5"
        android:id="@+id/pop_ratingbar"
        style="?android:attr/ratingBarStyleSmall"
    />
    
    RatingBar ratingBar = (RatingBar) findviewbyid(R.id.pop_ratingbar);
    ratingBar.setRating(4.0f); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been successful with creating a Telerik grid to display a list of
I'm trying to create an iphone app which grabs a JSON string, parses it
I have been trying for days to figure out how to parse this JSON
I have successfully parsed my json images and displayed the response as image ,however
Currently I am using the following code to parse the JSON link sent. This
I can successfully parse the contents of a JSON file, using the JSON-Framework 3.0,
I am trying to parse the JSON at this URL: http://maps.googleapis.com/maps/api/geocode/json?address=canada&sensor=false in Objective-C. I'm
I am trying to parse Open Exchange Rates JSON in Json, and I'm using
I'm trying to load and parse json data from an external source into a
jQuery's jqXHR object passed to the callback on failure does not parse json responses,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.