SQLiteNoob
SQLiteNoob

Reputation: 3022

How to place more than one view into a variable

So if I have one layout that I would like to apply an animation to, I can do something like:

LinearLayout mAnimate;
mAnimate = (LinearLayout) findViewById(R.id.layout1);

And do my stuff with mAnimate. But how do get several views into mAnimate?

Ie.

      LinearLayout layout1 = (LinearLayout) findViewById(R.id.layout1);
      LinearLayout layout2 = (LinearLayout) findViewById(R.id.layout2);  
     // mAnimate = ??

What type should mAnimate have? Is there some array to use?

Thanks for any help.

Upvotes: 0

Views: 37

Answers (1)

Merlevede
Merlevede

Reputation: 8180

Try something like this

LinearLayout layout1 = (LinearLayout) findViewById(R.id.layout1);
LinearLayout layout2 = (LinearLayout) findViewById(R.id.layout2);  
ArrayList <LinearLayout> myArray;
myArray.add(layout1);
myArray.add(layout2);

Upvotes: 1

Related Questions