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

  • SEARCH
  • Home
  • 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 8336831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:06:59+00:00 2026-06-09T04:06:59+00:00

I saw a code from Android Hive, and I learned how to send array

  • 0

I saw a code from Android Hive, and I learned how to send array JSON from the PHP script to my Android / Java code. I successfully retrieved all the details from my online database and displayed them in my desired format.

The problem is, I don’t know hot to set an image’s src when it is inside a ListView.
Here’s my code.

                ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
                JSONParser jParser = new JSONParser();
                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);

Please help me, thanks.

  • 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-09T04:07:00+00:00Added an answer on June 9, 2026 at 4:07 am

    For that i would suggest you to define a custom adapter for your ListView.

    1. You can create custom adapter class by extending either BaseAdapter or ArrayAdapter.
    2. override getView() method.
    3. Follow ViewHolder pattern while overiding getView() method.

    Here, Ravi has written about: Android custom ListView with Images and Text.

    And the best solution so far: Andoid – Lazy Load of Images in ListView

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw a piece of code from a website which is in php. In
I want to send some information from PHP to Java. Why? Because I have
I once saw a framework or code from some PHP that had an error
I saw a piece of code which was written like this: if (from n
i want to launch an intent from android website what code do i need
Just finished my code to use the default Media Player from Android, pretty pleased
I saw the code from here Post.published.collect(&:views_count) I guess it equals to .collect {
I downloaded some example code from github and saw that the BookRepository.cs class was
My friend saw my code, a part is get a plist data from URL
I was looking at some code from a colleague and saw the following method:

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.