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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:18:55+00:00 2026-05-27T05:18:55+00:00

I have a parsed list view. The number of elements are not fixed. When

  • 0

I have a parsed list view. The number of elements are not fixed.
When i click an item of the listview, it show the corresponding file on the other activity as i need.
so far this all is working as i want.
Now i want to show thumbnail on each List item. the file that opens on each click is a “.png” file, and i want to show that png as a thumbnail too on the list (each item having its respective thumbnail)
How can i do this?? i am new to android so plz give me code sample for help.
i have done alot searching and read about lazy loading kind of stuff but its very complicated for me.
thanks in advance for help!!

  • 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-05-27T05:18:55+00:00Added an answer on May 27, 2026 at 5:18 am

    You need to extend the adapter for the listview then in the getView() method of the adapter specify a custom layout.

    private class MyAdapter extends ArrayAdapter</*params*/> {
    
        private ArrayList</*params*/> items;
    
        //you will a reference to a context in getView()
        private Context ctx;
    
        public MyAdapter(Context context, int resourceId, ArrayList</*params*/> items) {
                super(context, resourceId, items);
                this.items = items;
                this.ctx = context;
        }
    
    //here is where you can create a custom view for each list item
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
    
                View v = convertView;
                if (v == null) {
                    LayoutInflater vi = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    v = vi.inflate(R.layout.my_custom_view, null);
    
                   //Your custom view will contain an ImageView 
                   //which you can assign the thumbnail to.
                   ImageView image = (ImageView)convertView.findViewById(R.id.my_custom_view_thumbnail);
    
                   //set the thumbnail from a drawable resource
                   new GetImage("http://www.example.com").execute(image);
    
                }
    
                return v;
        }
    }
    

    For downloading an image

    public class GetImage extends AsyncTask<ImageView, Void, ImageView> {
    
        String url = null;
        Bitmap thumbnail = null;
        public GetImage(String url){
            this.url = url;
        }
        @Override
        protected void onPreExecute() {
    
        }
    
        @Override
        protected ImageView doInBackground(ImageView... params) {
    
            try {
                thumbnail = BitmapFactory.decodeStream((InputStream) new URL(url).getContent());
    
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return params[0];
    
        }
    
        @Override
        public void onPostExecute(ImageView result) {
            result.setImageBitmap(thumbnail);
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an RSS feed parsed into a list view in my app. I'm
I have recently built a list view which shows a number of products taken
I have parsed XML file into objects, in which each object has a 1:1
Problem: I have a method that creates a list from the parsed ArrayList. I
My list view contains 3 columns Name, address and phone number. I want to
i have got ListView of Inbox SMS.I am trying, if i click on any
I have a List<ListViewItem> and I've used it in a ListView in VirtualMode There
Assumptions about the list (updated): It will not contain more than 10 list elements
I have a custom listview row that contains a number of textView components. Instead
I have a listview populated by a text file hosted on my website that

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.