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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:45:28+00:00 2026-06-02T15:45:28+00:00

I extend ViewFlipper widget. When I initializ MyViewFlipper I pass List oа object to

  • 0

I extend ViewFlipper widget. When I initializ MyViewFlipper I pass List oа object to it. MyViewFlipper perform it list and add some views to MyViewFlipper.

My activity has android:configChanges=”keyboardHidden|orientation”, therefor my views hiererchy not recreating when device orientation changed.

Which method I must override in my MyViewFlipper to process orientation changed event to recreate my child views in MyViewFlipper?

How to do it others views?

Methid, that perform List of object in MyViewFlipper:

public void setUsers(List<User> users)
{
    removeAllViews();

    Display display = ((WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    int maxWidth = display.getWidth();

    screens = new LinearLayout[maxScreens];
    int fillingScreen = maxScreens;

    while(fillingScreen > 0) 
    {
        LinearLayout linearLayout = new LinearLayout(getContext());
        linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));
        linearLayout.setGravity(Gravity.CENTER);
        screens[fillingScreen - 1] = linearLayout;
        fillingScreen --;
    }

    int currentUser = 0;

    while(currentUser < users.size() && fillingScreen < maxScreens)
    {

        LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.item_people_category_item, null);
        ImageView iv = (ImageView) linearLayout.findViewById(R.id.item_people_category_item_avatar);

        screens[fillingScreen].addView(linearLayout);
        screens[fillingScreen].measure(0, 0);

        if (screens[fillingScreen].getMeasuredWidth() >= maxWidth)
        {
            screens[fillingScreen].removeView(linearLayout);
            addView(screens[fillingScreen]);
            fillingScreen ++;
        }
        else 
        {
            User user = users.get(currentUser);
            iv.setOnClickListener(ouUserClicked);
            linearLayout.setTag(user);
            App._IMAGEMANAGER.setImage(user.getPhoto(), iv, R.drawable.no_photo);
            currentUser++;
        }
    }

    if (fillingScreen < maxScreens && screens[fillingScreen].getParent() == null) addView(screens[fillingScreen]);
}

It simpe add some LinwarLayout to ViewFlipper with muximim possiable number of objects.

PS:

   @Override
    public void onConfigurationChange(Configuration newConf) {
      // notify view flopper here
    }

Other views in my layout not need to notify. They change representation self. Whih method they use for it? onMeauser()?

  • 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-02T15:45:30+00:00Added an answer on June 2, 2026 at 3:45 pm

    You should override

     @Override
    public void onConfigurationChanged(Configuration newConfig) {
     super.onConfigurationChanged(newConfig);
    }
    

    this to detect orientation changes…

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

Sidebar

Related Questions

I have a ViewFlipper in which I want to add Views (Relative Layout with
I want to add Views programmatically to a ViewFlipper : flipper.addView(anEpisode(name, null, description), i);
I'm trying to create a ViewFlipper where each child View has some minimum size
I have a ViewFlipper defined that contains 3 views... <?xml version=1.0 encoding=utf-8?> <ViewFlipper xmlns:android=http://schemas.android.com/apk/res/android
I've got an activity where a viewflipper shows a list containing the artists from
Hi I need to extend the CListControl class in C++/MFC, which will add several
I'm trying to extend a form and add an upload file field from within
I'm having some trouble switching activities. I'm thinking it has something to do with
Hey. I just started with Android. I'm using the ViewFlipper layout with 2 LinearLayouts.
To extend the User object with custom fields, the Django docs recommend using UserProfiles

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.