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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:24:10+00:00 2026-06-14T07:24:10+00:00

I am trying to develop a wallpaper application. When the application launches, an activity

  • 0

I am trying to develop a wallpaper application. When the application launches, an activity shows the categories (an image and corresponding name on a textView) on a gridView. When I select a category, it navigates to a sub-category. In sub-category activity, it also shows subcategory image with its corresponding name on textVew.
Problem is in sub-category activity images are not loading. Sometimes it loads a image; when i press back-button, then select that sub-category again, it loads three mode image; pressing back button and selecting than sub-category causes loading another three images (now its total 10 images).
The images is cached on the disk properly.
Here is my configuration:

   cacheDir = new File(Environment.getExternalStorageDirectory(),
                    "peakwallpapers/cache"); // --
            // Create configuration for ImageLoader
            config = new ImageLoaderConfiguration.Builder(this).enableLogging()
                    .discCache(new UnlimitedDiscCache(cacheDir))
                    .memoryCache(new UsingFreqLimitedMemoryCache(2000000))
                    .denyCacheImageMultipleSizesInMemory().threadPoolSize(10)
                    .threadPriority(Thread.MIN_PRIORITY + 2)
                    .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
                    .build(); // --

            options = new DisplayImageOptions.Builder()
                    .showStubImage(R.drawable.stub_image)
                    .showImageForEmptyUri(R.drawable.image_for_empty_url)
                    .cacheInMemory().cacheOnDisc().build();
            imageLoader.init(config);

Here is the getView() methood:

   @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            final View rowView;
            final ViewHolder viewHolder = new ViewHolder();
            if (convertView == null) {
                rowView = getLayoutInflater().inflate(
                        R.layout.item_sub_category_grid, null);

                viewHolder.imageView = (ImageView) rowView
                        .findViewById(R.id.image_item_sub_category);
                viewHolder.textView = (TextView) rowView
                        .findViewById(R.id.text_item_sub_cat_desc);

                rowView.setTag(viewHolder);

            } else {
                rowView = (View) convertView;
            }

            ViewHolder holder = (ViewHolder) rowView.getTag();
            holder.textView.setText(wpSubCategories.get(position)
                    .getSubCategoryName());

            imageLoader.displayImage(imageUrls[position], viewHolder.imageView,
                    options, new SimpleImageLoadingListener() {
                @Override
                public void onLoadingStarted() {
                    showLoading();
                }
                        @Override
                        public void onLoadingComplete(Bitmap loadedImage) {
                            Animation anim = AnimationUtils.loadAnimation(
                                    SubCategoryGridActivity.this,
                                    R.anim.fade_in);
                            viewHolder.imageView.setAnimation(anim);
                            anim.start();
                        }
                    });

            return rowView;
        }
    }

My Grid layout: sub_category_grid.xml :

<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gridview_sub_category"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center"
    android:horizontalSpacing="4dip"
    android:numColumns="2"
    android:verticalSpacing="4dip" />

and My item of grid: item_sub_category_grid.xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/frame_l_item_sub_category_item"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight=".5"
    android:background="@drawable/textlines" >

    <ImageView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/image_item_sub_category"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:contentDescription="@string/descr_image"
        android:scaleType="centerCrop" />

    <TextView
        android:id="@+id/text_item_sub_cat_desc"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@drawable/cat_bg"
        android:gravity="center_horizontal"
        android:text="TextView"
        android:textColorHighlight="#656565"
        android:typeface="monospace" >
    </TextView>

</FrameLayout>

N.B: It shows no error on LogCat.

  • 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-14T07:24:11+00:00Added an answer on June 14, 2026 at 7:24 am

    First of all, I think your thread pool size is too big. Of course it depends on devices your app is targeted. But it will work really slow on not-modern devices. I think 5 is enough, but you should test it yourself. Vary thread pool size and thread priority to achieve best speed and performance.

    Second: you have a logical mistake in your getView() method. Move
    final ViewHolder viewHolder = new ViewHolder();
    after
    if (convertView == null) {
    and you’ll see the problem. Your vars viewHolder and holder logically overlaps each other.

    UPD: Don’t call ImageLoader.stop() in activity’s onStop() if you do.

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

Sidebar

Related Questions

I am trying to develop an application for my localhost on which I can
I am trying to develop an application to forward received SMS to a web
Iam trying to develop a web application, where when a button is clicked the
I'm trying to develop a Django application with relation to exercises per workout. I
I'm trying to develop an application for android with NFC-tags. When I find a
I am trying to develop an Android based application, which can play video from
I am trying to develop an application in Java (Swing) that lets me overlay
I am trying to develop an application which will record voice and plot a
I am trying to develop an Android live wallpaper using OpenGL wallpaper service ,
I'm trying develop a sample application with multi language files. I use: Windows 7

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.