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

  • Home
  • SEARCH
  • 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 4591828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:27:06+00:00 2026-05-21T22:27:06+00:00

I have a ViewFlipper that shows 2 imageview (red one when disconnected and the

  • 0

I have a ViewFlipper that shows 2 imageview (red one when disconnected and the green other when connected), however, i have a strange result: sometimes the red image is showen when i’m connected, it switches like this : red-green-and returns red(even when i’m connected).
Here is the JAVA code:

public void onRegistrationDone(String localProfileUri, long expiryTime) {

                        updateStatus("Enregistré au serveur.");
                        Log.d("SUCCEED","Registration DONE");

                        final ViewFlipper flipper = (ViewFlipper)findViewById(R.id.flipper);
                        flipper.postDelayed(new Runnable() {
                        public void run() {
                        flipper.showNext();
                            }
                        },2000);}

The view is initiated with the red image, then, when connected(and after 2 seconds) the next image is normally showen.

What could be the problem?
Thank you very much.

EDIT: XML file (Handler)

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

<TextView
  android:id="@+id/sipLabel"
  android:textSize="20sp"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  />
  <ImageView android:id="@+id/status"  android:layout_below="@id/sipLabel" 
  android:layout_width="fill_parent" android:scaleType="center"
        android:layout_height="fill_parent" android:layout_weight="0.35" android:gravity="center"

         />
        </LinearLayout>
  • 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-21T22:27:07+00:00Added an answer on May 21, 2026 at 10:27 pm

    I would do that differently. If that is just a matter of displaying different image (red/green) I would use ImageView UI control to display that image. And for the delayed display update you may use Handler. Something like this:

    public void onRegistrationDone(String localProfileUri, long expiryTime) 
    {
        updateStatus("Enregistré au serveur.");
        Log.d("SUCCEED","Registration DONE");
    
        mRegistered = true;
        mRegistrationUpdateHandler.removeCallbacks(handleUpdateStatus);
        mRegistrationUpdateHandler.postDelayed(handleUpdateStatus, 2000);
    }
    
    public void onRegistrationLost()
    {
        mRegistered = false;
        mRegistrationUpdateHandler.removeCallbacks(handleUpdateStatus);
        mRegistrationUpdateHandler.postDelayed(handleUpdateStatus, 2000);
    }
    
    private Runnable handleUpdateStatus = new Runnable() 
    {     
        public void run()
        {
            ImageView statusImageDisplay = (ImageView)findViewById(R.id.statusImage);
            if (mRegistered)
            {
                statusImageDisplay.setImageDrawable(getResources().getDrawable(R.drawable.imageGreen));
            else
            {
                statusImageDisplay.setImageDrawable(getResources().getDrawable(R.drawable.imageRed));
            }
        }
    };  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ScrolLView that wraps a ViewFlipper. The content in the ViewFlipper is
I have a ViewFlipper in my Activity that is used as a footer view
I need some help. In my android app I have a ViewFlipper that contains
I have a ViewFlipper implementation that needs to be improved. This ViewFlipper has three
I'm making an Android app and have a strange problem. I need a ViewFlipper
My situation is following. I have one Activity that contains three main parts. At
I have 3 Activity's that i like to put into a ViewFlipper configuration. Right
I have a TabHost that has two ViewFlippers, and inside each ViewFlipper are three
Basically, I have a ViewFlipper that flips when I swipe my finger on it.
I have got a ViewFlipper that gets populated with multiple views, that are actually

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.