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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:43:12+00:00 2026-05-26T21:43:12+00:00

Right now I’m able flip views using sliding. I want to flip views automatically

  • 0

Right now I’m able flip views using sliding. I want to flip views automatically after say 5 seconds.

The code I have to flip views based on gesture recognition is:

class MyGestureDetector extends SimpleOnGestureListener {
    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
            float velocityY) {
        try {
            if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
                return false;
            // right to left swipe
            if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
                    && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                viewFlipper.setInAnimation(slideLeftIn);
                viewFlipper.setOutAnimation(slideLeftOut);

                if (currentIndex == maxIndex) {
                    currentIndex = 0;
                } else {
                    currentIndex = currentIndex + 1;
                }
                if (currentView == 0) {
                    currentView = 1;
                    ImageView iv = (ImageView) findViewById(R.id.one);
                    /*iv.setImageDrawable(Drawable.createFromPath(ImageList
                            .get(currentIndex)));*/
                    Bitmap mBitmap=BitmapFactory.decodeFile(ImageList.get(currentIndex));
                    iv.setImageBitmap(mBitmap);
                    Log.d("image list index!!", ImageList.get(currentIndex));
                    System.gc();

                } else if (currentView == 1) {
                    currentView = 2;
                    ImageView iv = (ImageView) findViewById(R.id.two);
                    /*iv.setImageDrawable(Drawable.createFromPath(ImageList
                            .get(currentIndex)));*/
                    Bitmap mBitmap=BitmapFactory.decodeFile(ImageList.get(currentIndex));
                    iv.setImageBitmap(mBitmap);
                    Log.d("image list index!!", ImageList.get(currentIndex));

                    System.gc();
                } else {
                    currentView = 0;
                    ImageView iv = (ImageView) findViewById(R.id.zero);
                    /*iv.setImageDrawable(Drawable.createFromPath(ImageList
                            .get(currentIndex)));
                    */
                    Bitmap mBitmap=BitmapFactory.decodeFile(ImageList.get(currentIndex));
                    iv.setImageBitmap(mBitmap);
                    Log.d("image list index!!", ImageList.get(currentIndex));

                    System.gc();
                }
                Log.v("ImageViewFlipper", "Current View: " + currentView);
                viewFlipper.showNext();
                viewFlipper.startFlipping();
            } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
                    && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                viewFlipper.setInAnimation(slideRightIn);
                viewFlipper.setOutAnimation(slideRightOut);
                if (currentIndex == 0) {
                    currentIndex = maxIndex;
                } else {
                    currentIndex = currentIndex - 1;
                }
                if (currentView == 0) {
                    currentView = 2;
                    ImageView iv = (ImageView) findViewById(R.id.two);
                    iv.setImageDrawable(Drawable.createFromPath(ImageList
                            .get(currentIndex)));
                    System.gc();
                } else if (currentView == 2) {
                    currentView = 1;
                    ImageView iv = (ImageView) findViewById(R.id.one);
                    iv.setImageDrawable(Drawable.createFromPath(ImageList
                            .get(currentIndex)));
                    System.gc();
                } else {
                    currentView = 0;
                    ImageView iv = (ImageView) findViewById(R.id.zero);
                    iv.setImageDrawable(Drawable.createFromPath(ImageList
                            .get(currentIndex)));
                    System.gc();
                }
                Log.v("ImageViewFlipper", "Current View: " + currentView);
                viewFlipper.showPrevious();
            }
        } catch (Exception e) {
            // nothing
        }
        return false;

    }

}

I am flipping using viewFlipper.showNext() and showPrevious() methods now.
I tried using

       viewFlipper.setFlipInterval(1000);

and viewFlipper.startFlipping();
methods. The problem I am facing now is there are 3 imageviews I need to load one after the other in a row continuously (and images should change in each of the imageviews as they move on). This is not happening. I can see only 2 fixed images just displaying one after the other without any change in their content. How do I solve this issue?

  • 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-26T21:43:13+00:00Added an answer on May 26, 2026 at 9:43 pm

    have a look at startFlipping()
    and setFlipInterval() methods in ViewFlipper class

    http://android-er.blogspot.com/2011/03/auto-flipping-of-viewflipper.html

    follow the above link.hope it helps

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

Sidebar

Related Questions

Right now, I have code that looks something like this: Private Sub ShowReport(ByVal reportName
Right now, I have three models Post, Comment and User (using Devise ) associated
Right now, I have basic code for moving the textfield above the keyboard when
Right now I'm using the jQuery selector $('foo+bar') . Since I already have $('foo')
right now I have a keyboard macro defined and named, and i want to
Right now I have the following piece of code: RSpec::Matchers.define :include_an_html_tag do |tag| tag
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as
Right now I have an SSIS package that runs every morning and gives me
Right now, I have two Eclipse projects - they both use Maven 2 for
Right now, I have a domain entity named StyleBundle. This StyleBundle takes a list

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.