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 8364679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:28:49+00:00 2026-06-09T12:28:49+00:00

ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); JSONObject json = jParser.getJSONFromUrl(http://domain.com/directory/database/retrieveComments.php?placeId= + stringPlaceId); try

  • 0
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
    JSONObject json = jParser.getJSONFromUrl("http://domain.com/directory/database/retrieveComments.php?placeId=" + stringPlaceId);
    try
    {
        commentsRatingsArray = json.getJSONArray("commentsRatings");
        for(int i = 0; i < commentsRatingsArray.length(); i++)
        {
        JSONObject jsonObject = commentsRatingsArray.getJSONObject(i);
        String dbUserFullName = jsonObject.getString(TAG_FULLNAME);
        String dbUserEmail = jsonObject.getString(TAG_EMAIL);
        String dbComment = jsonObject.getString(TAG_COMMENT);
        String dbRating = jsonObject.getString(TAG_RATING);
        String dbDate = jsonObject.getString(TAG_DATE);
        String dbTime = jsonObject.getString(TAG_TIME);

        HashMap<String, String> map = new HashMap<String, String>();
        map.put(TAG_FULLNAME, dbUserFullName);
        map.put(TAG_EMAIL, dbUserEmail);
        map.put(TAG_COMMENT, dbComment);
        map.put(TAG_RATING, dbRating);
        map.put(TAG_DATE, dbDate);
        map.put(TAG_TIME, dbTime);

        list.add(map);
    }   
}
catch (Exception e)
{
     e.printStackTrace();
     Toast.makeText(getBaseContext(), "Connection to the server is lost. Please check your internet connection.", Toast.LENGTH_SHORT).show();
}

ListAdapter adapter = new SimpleAdapter
(DisplayCommentsRatings.this, list, R.layout.commentrating,

     new String[] { TAG_FULLNAME, TAG_EMAIL, TAG_COMMENT, TAG_DATE,  TAG_TIME },
     new int[] {R.id.tvUserFullName, R.id.tvUserEmail, R.id.tvUserComment, R.id.tvDate, R.id.tvTime });

     setListAdapter(adapter);

Here’s my code, I’m getting these JSON Array values from my database. I just want to know how to change an image’s src inside a list view. Because I will only use 5 images, I decided to include these images in my assets folder instead of uploading them to the web.

Can someone give me an idea to make this possible?

Here’s my XML code:

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/tvUserFullName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#000000"
        android:textSize="12dip"
        android:textStyle="bold"/>
            //This is the imageView where I will display the image from the assets folder
    <ImageView
        android:id="@+id/ivUserRating"
        android:layout_width="100dip"
        android:layout_height="fill_parent"
        android:src="@drawable/zerostar"/>

</LinearLayout>

<TextView
    android:id="@+id/tvUserEmail"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="EmailAddress@domain.com"
    android:textSize="9dip"/>

<TextView
    android:id="@+id/tvUserComment"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text='"This is a comment. This is a comment. This is a comment. This is a comment. This is a comment."'
    android:textSize="10dip"
    android:layout_margin="3dip"
    android:textColor="#000000"
    android:maxLength="300"/>

<TextView
    android:id="@+id/tvDate"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:text="August 1, 2010"
    android:textColor="#000000"
    android:textSize="8dip"
    android:layout_gravity="right"/>

<TextView
    android:id="@+id/tvTime"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:text="08:20 PM"
    android:textColor="#000000"
    android:textSize="8dip"
    android:layout_gravity="right"/>

  • 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-09T12:28:50+00:00Added an answer on June 9, 2026 at 12:28 pm

    check position and use like,

    Bitmap bmp=null;
    
    if(position==0){
    
       bitmap=getBitmap("img0.png");
    
    }else if  (position==1){
    
       bitmap=getBitmap("img1.png");
    }
    .
    .
    .
    

    Method::

    private Bitmap getBitmap(String name) throws IOException
            {
                AssetManager asset = getAssets();
    
                InputStream is = asset.open(name);
                Bitmap bitmap = BitmapFactory.decodeStream(is);
    
                return bitmap;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Map<String, List<String>> words = new HashMap<String, List<String>>(); List<Map> listOfHash = new ArrayList<Map>(); for (int
i have some listview and SimpleAdapter List<HashMap<String, Object>> dataList = new ArrayList<HashMap<String, Object>>(); HashMap<String,
I have the following ArrayList ArrayList<HashMap<String, String>> list; HashMap<String, String> map; with the following
I have an ArrayList of HashMap like this: ArrayList<HashMap<String, String>> playListSongs = new ArrayList<HashMap<String,
Title says all. Sample code: ArrayList<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>(); HashMap<String, Object>
I have a List of HashMap such as below ArrayList l = new ArrayList
I have a code like this Map<String, List> searchMap = new HashMap<String, List>(); for(int
given the following code? final Map<String, List<E>> map = new HashMap<String, List<E>>(); List<E> list
listview jArray = new JSONObject(result); json = jArray.getJSONArray(mainmenu); list = (ListView) findViewById(R.id.mainmenulist); adapter =
I want to return ArrayList<HashMap<String,String>> in EL function with three String argument. How to

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.