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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:37:51+00:00 2026-06-11T08:37:51+00:00

I am trying to use ViewSwitcher to act like a image wizard. I mean

  • 0

I am trying to use ViewSwitcher to act like a image wizard.

I mean there will be next and previous button to change the Image in a ViewSwitcher rather then a gallery. I have taken a reference from API Demo of android sample application.

in that they have used ViewSwitcher and Gallery but i have to use Next and Prev button
instead. But i dont know how to do it.

As in sample application they have used

Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this));
g.setOnItemSelectedListener(this);

Where ImageAdapter keeps adding new Images in a ImageView which itself residing in a ViewSwitcher. So how can i do the same with next and previous button ?

Sample App Screen

  • 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-11T08:37:52+00:00Added an answer on June 11, 2026 at 8:37 am

    If you use an ImageSwitcher this is a very simple thing to do. You’ll have to replace the Gallery with your two Buttons and link them to the ImageSwitcher :

    private int[] mImageIds= //.. the ids of the images to use
    private int mCurrentPosition = 0; // an int to monitor the current image's position
    private Button mPrevious, mNext; // our two buttons
    

    The two buttons will have two onClick callbacks:

    public void goPrevious(View v) {
        mCurrentPosition -= 1;
        mViewSwitcher.setImageResource(mImageIds[mCurrentPosition]);
        // this is required to kep the Buttons in a valid state
        // so you don't pass the image array ids boundaries 
        if ((mCurrentPosition - 1) < 0) {
            mPrevious.setEnabled(false);
        }
        if (mCurrentPosition + 1 < mImageIds.length) {
            mNext.setEnabled(true);
        }
    }
    
    public void goNext(View v) {
        mCurrentPosition += 1;
        mViewSwitcher.setImageResource(mImageIds[mCurrentPosition]);
        // this is required to kep the Buttons in a valid state
        // so you don't pass the image array ids boundaries 
        if ((mCurrentPosition + 1) >= mImageIds.length) {
            mNext.setEnabled(false);
        }
        if (mCurrentPosition - 1 >= 0) {
            mPrevious.setEnabled(true);
        }
    }
    

    You’ll have to remember to disable the previous Button in the onCreate method(as we start with the first image in the array).

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

Sidebar

Related Questions

I am need paint my image. I'm trying use JQuery in here this link:
I have been trying use the edit_post_link() function to contain an image. All of
Anyone know how to create a cvCreateStructuringElementEx using a image? I'm trying use opencv.cv.cvCreateStructuringElementEx()
I'm trying use to selenium with firefox on CentOS from command line like this:
i'm trying use webview to load a image from sdcard i use this path
I'm trying use epoch time dates in my series data. The array looks like
I'm trying use this code to get image resolution from file bool GetImageSizeEx(const char
i'm trying use facebook API to upload photo in my fan page. I downloaded
I am trying use gem tire to search in my application. I have tables
I was trying use a set of filter functions to run the appropriate routine,

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.