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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:54:19+00:00 2026-06-13T23:54:19+00:00

Edit: Ok, i took the advice given in the answers and the difference is

  • 0

Edit: Ok, i took the advice given in the answers and the difference is huge! I’ve replaced my SeriesAdapter in the post with the new one.
For one a know make the calculations with in the sql query (to know
total number of episodes and totalt numer of watched episodes). I also
store the bitmap in a hashmap once it has been loaded so that it don’t
have to load twice, I’m looking in to some other solution as I’m
afraid of OutOfMemoryException.

I am new to android and i want to display an listview with images that i have stored on the external storage.

The images are downloaded earlier and are now as I said stored in the external storage, here is an example of the images http://thetvdb.com/banners/graphical/80348-g32.jpg and I compress the images to 80% when saving them to save some space.

I have tried several methods to make the listview scroll smooth but I’m clearly in over my head here. I have provided my layout for the list items and my adapter in case I do something strange here.

I would appreciate any tips and tricks that would improve my listview.

SeriesAdapter:

public static class SeriesAdapter extends ArrayAdapter<Series> {

    static class viewHolder
    {
        ImageView image;
        TextView information;
        String seriesId;
        String season;
        ProgressBar progress;
        TextView txtSmallView;
    }

    private final Context context;
    private final ArrayList<Series> series;
    private DateHelper dateHelper;
    private final DatabaseHandler db;
    Object mActionMode;
    int resource;

    public SeriesAdapter(Context context, int resource, ListView lv, ArrayList<ExtendedSeries> objects)
    {
        super(context, resource, objects);
        this.context = context;
        this.series = objects;
        this.resource = resource;
        db = new DatabaseHandler(context);
        dateHelper = new DateHelper();  

        cache = new HashMap<String, Bitmap>();
    }



    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {

        viewHolder holder;
        ExtendedSeries s = series.get(position);

        if(convertView == null)
        {
            convertView = View.inflate(context, resource, null);
            holder = new viewHolder();

            holder.image = (ImageView)convertView.findViewById(R.id.imgSeriesImage);
            holder.information = (TextView)convertView.findViewById(R.id.txtUpcomingEpisode);
            holder.progress = (ProgressBar)convertView.findViewById(R.id.pgrWatched);                       

            convertView.setTag(holder);
        }
        else
        {
            holder = (viewHolder)convertView.getTag();
        }


        if(s != null)
        {
            holder.seriesId = s.getImage();


            convertView.setTag(R.string.homeactivity_tag_id,s.getID());
            convertView.setTag(R.string.homeactivity_tag_seriesid,s.getSeriesId());

            holder.progress.setMax(s.getTotalEpisodes());
            holder.progress.setProgress(s.getWatchedEpisodes());
            holder.image.setImageBitmap(getBitmapFromCache(s.getImage()));
            holder.information.setText(s.getNextEpisodeInformation().equals("") ? context.getText(R.string.message_show_ended) : s.getNextEpisodeInformation());        

        }


        return convertView;

    }

Listitem layout

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

<ImageView
    android:id="@+id/imgSeriesImage"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:focusable="false"
    android:scaleType="centerCrop"
    android:src="@drawable/noimage" />

<RelativeLayout
    android:id="@+id/relProgressView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusable="false"
    android:orientation="vertical" >

    <ProgressBar
        android:id="@+id/pgrWatched"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="fill_parent"
        android:layout_height="21dp"
        android:max="100"
        android:progress="50"
        android:progressDrawable="@drawable/progressbar" />

    <TextView
        android:id="@+id/txtUpcomingEpisode"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:focusable="false"
        android:padding="3dp"
        android:scrollHorizontally="true"
        android:scrollbars="none"
        android:shadowColor="@android:color/black"
        android:shadowDx="1"
        android:shadowDy="1"
        android:shadowRadius="1"
        android:textAllCaps="true"
        android:textColor="#ffffffff"
        android:textSize="11sp"
        android:textStyle="normal|bold"
        android:typeface="normal" />
</RelativeLayout>

Activity layout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ListView
        android:id="@+id/lstMySeries"
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:longClickable="true"
        android:divider="#000000"
         />

  • 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-13T23:54:21+00:00Added an answer on June 13, 2026 at 11:54 pm

    The getView method needs to be as light as possible as this is called for every item in the row when it is shown onscreen.

    You already implement the viewHolder pattern which is good, but you also need to preprocess your “watched episode” logic so you are not looping and counting in the display code. You also need to do the db.GetAiredEpisodes call outside of this method call.

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

Sidebar

Related Questions

EDIT I'm understand the table is a mess. I took over this project and
EDIT After staring at this for 2 days, I do see one issue. I
::Edit:: @cache_control(no_cache=True, must_revalidate=True, no_store=True) FTW!!!!! Cache-Control: no-cache, no-store, must-revalidate did the trick. It took
I was getting advice from Rob Kennedy and one of his suggestions that greatly
EDIT -- took the code from below and made it so it can handle
Been trying to do this for quite a while and took advice from every
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT: I was an idiot. I simply had an image that was vertically long,
EDIT: See my answer below--> I am wanting to have a view that when
Edit (updated question) I have a simple C program: // it is not important

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.