I'm creating android app that has table layout for the main activity, and that part works perfectly... Now, the idea was to add another part of an app below the existing components, but now I have to put a tabbed layout there. Well, that part also works perfectly when I try to run just that. But what do I have to do to mix those two in such a way that these two show up one below another on the very same screen.
My main code is:
package my.android;
import android.os.Bundle;
public class MyActivity extends FragmentActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
I have different layout files for all the tabs and I have my TabsActivity class I have created following the tutorial here: http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/
So how do I add some TabsActivity ta object to the MyActivity? And it is important to be below the content of this. Thaks in advance...
Ideally this would be done using nested Fragments, but Android doesn't support that yet. That leaves the deprecated ActivityGroup class. You'll need a top level activity that extends ActivityGroup and launches the two activities.
Here is how you launch the activities and get their views:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Edit: Below is a more complete solution.
This is the layout for the top level activity:
Here is the top level class:
You can add as many embedded activities as you want. You can even nest embedded activities, but be aware that performance could become a factor. We use this to support a dynamic status column.
Personally, I think there is still a use for the ActivityGroup and hope that Gooogle changes their mind about deprecating it.