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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:57:43+00:00 2026-06-09T01:57:43+00:00

I am trying to load images into my FlipView using AsyncTask but Im not

  • 0

I am trying to load images into my FlipView using AsyncTask but Im not sure how to continue.
I need to use AsyncTask because the application is force closing since I have 20 images to load from the drawables.

private class asyncImage extends AsyncTask<Void, Void, Void>{
        int i;
        @Override
        protected Void doInBackground(Void... params) {
            for (i=0;i<imageID.length;i++){
                image = new ImageView(getBaseContext());
                image.setId(i);
                image.setImageResource(imageID[i]);
                image.setBackgroundDrawable(getResources().getDrawable(R.drawable.border));
                image.setScaleType(ImageView.ScaleType.FIT_XY);
                FlipV.addView(image);
            }
            return null;
        }

    protected void onPostExecute(Void result){

        image.setBackgroundDrawable(getResources().getDrawable(R.drawable.border));
        image.setScaleType(ImageView.ScaleType.FIT_XY);
        for(int x=0;x<imageID.length;x++){
            FlipV.addView(???); //How to add images into FlipView?
        }
    }

}

Im stuck in adding the images to the FlipView. Any 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-06-09T01:57:46+00:00Added an answer on June 9, 2026 at 1:57 am

    As I have mentioned from my comment I’ve already solved my problem by using an imageview array instead ang loading the images in the doInBackground and adding the imageviews in the viewflipper in the postExecute. I’ve also added a progress dialog to show a loading time instead of a blank screen in my app. Thanks to everyone that replied.

    private class asyncImage extends AsyncTask<Void, Void, Void>{
            int i;
            @Override
            protected Void doInBackground(Void... params) {
                for (i=0;i<imageID.length;i++){
                    image[i] = new ImageView(getBaseContext());
                    image[i].setImageResource(imageID[i]);
                    image[i].setBackgroundDrawable(getResources().getDrawable(R.drawable.border));
                    image[i].setScaleType(ImageView.ScaleType.FIT_XY);
                }
                return null;
            }
    
            protected void onPostExecute(Void result){
                for (int x=0;x<imageID.length;x++){
                FlipV.addView(image[x]);
                }
                count = 1;
                progDialog.dismiss();
                txItem.setText(Integer.toString(count) + "/" + (imageID.length));
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load some images using Bitmap.getBitmapResource() , but it takes about 2
I'm trying to load png images into my game, but for some reason it
Using javascript I'm trying to load images not on the current page (from an
I'm programming my first iOS application and I'm trying to asynchronously load images into
I'm trying to load a block of HTML into a TextView, including images, using
As the title says im trying to load Facebook profile images into flash using
I'm trying to load in some decently large images into a web application. The
trying to load in a bunch of images into a list from a directory...my
I'm trying to load about 600 small images into memory. Size of each image
I am trying to load into a scrollview 50 png images, and I chose

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.