Hi all,

I have an ActivityGroup with three Activities, A, B and C.

I get the three activities views by using
"View viewA = getLocalActivityManager().startActivity(mActivityAId,
mActivityAIntent).getDecorView()"
(for A, B and C)

I need viewA to be aligned to its parent top edge, and viewC to be aligned
to its parent bottom edge. viewB must be below A and above C.

For that I've created a RelativeLayout(mMainLayout), and then, since I have
the 3 views, I add them to that layout setting the LayoutParams properly.

So, I do the following:

***************
View viewA = getLocalActivityManager().startActivity(mActivityAId,
mActivityAIntent).getDecorView();
viewA.setId(mIdA);
RelativeLayout.LayoutParams paramsA = new
LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
paramsA.addRule(RelativeLayout.ALIGN_PARENT_TOP);
mMainLayout.addView(viewA, paramsA);

View viewC = getLocalActivityManager().startActivity(mActivityCId,
mActivityCIntent).getDecorView();
viewC.setId(mIdC);
RelativeLayout.LayoutParams paramsC = new
LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
paramsC.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mMainLayout.addView(viewC, paramsC);

View viewB = getLocalActivityManager().startActivity(mActivityBId,
mActivityBIntent).getDecorView();
viewB.setId(mIdB);
RelativeLayout.LayoutParams paramsB = new
LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
paramsB.addRule(RelativeLayout.ABOVE, viewC.getId());
paramsB.addRule(RelativeLayout.BELOW, viewA.getId());
mMainLayout.addView(viewB, paramsB);
***************

However I could notice that viewB is never rightly positioned. I started
testing with other views, and I've realized that if all views are created
from the same activity, the same as the main layout, I have no problem, but
when the views come from different activities the problem occurs.

I've also tested finding a view by its Id, and in fact I can not find views
by Id that were not created in the same activity as the main layout.
Explaning more clearer, I've replaced viewA for a local TextView, added it
to mainLayout and then tried to find it via
"mainLayout.findViewById(viewA.getId())", and it worked fine. But when I
used the real desired viewA (the activity A decor view), "findViewById"
returned null view.

Am I doing anything wrong? Was it designed to work this way? Or is it a bug?

I do need an answer the sooner the possible...

Taísa

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to