Access Listview from TabActivity

by Kid24 » Wed, 21 Apr 2010 02:30:27 GMT

Sponsored Links

I wonder if anyone can help me to solve my issue. The problem - I
can't find the way to get ListView reference that is the part of
I have 2 tabs - ListView, TextView. Theare no problem to access
TextView using the following code in TabActivity:

FrameLayout frame = tabHost.getTabContentView();
TextView text = (TextView)

But frame.getChildAt(0) returns$DecorView
And I actualy don't know the way how to cast this reference to the
object and to get its ListView child.

Could anybody help me, please?

Tab initialization code:

protected void onCreate(Bundle savedInstanceState) {

                final TabHost tabHost = getTabHost();

                                new Intent(this, MainListActivity.class)));

                                tabHost.getTabContentView(), true);



Access Listview from TabActivity

by Prajakta Shitole » Wed, 21 Apr 2010 05:26:56 GMT


You can have a list Activity and then in you tabActivity just pass that
activity in setcontent. For eg:
In the example below First.class and Second.class are my ListActivities.

public class ExampleTab extends TabActivity {

    protected void onCreate(Bundle savedInstanceState) {

        TabHost tabHost = getTabHost();


                .setContent(new Intent(this, First.class)));


                .setContent(new Intent(this, Second.class)));


Hope this helps,



Sponsored Links

Other Threads

1. Adding icon to a contextMenu


While Contextmenu items support calling setIcon :

               menu.add(0, ....).setIcon(;

the icon never gets displayed.

Is this a bug? a feature?

Is there a reasonably priced workaround for getting icons onto context


2. Confused about system services / processes / applications

Hi, Im currently trying to put together an idea of how
WindowManagerService works - who it works with and how it works.

WindowManagerService is a system service - running in the system
process I suppose.  So it needs IPC to interact with applications.  On
the application side we have ViewRoot which is at the root of every
window (activity) in an application.  This has code to communicate
with WindowManagerService via IWindowSession & IWindow.

Something called WindowManagerImpl creates ViewRoots, so I suppose
that WindowManagerImpl is executing in the application process.   Is
it kind of a proxy for for the WindowManagerService?  App code can get
a reference to WindowManagerImpl and thus get WindowManagerService to
do things (via ViewRoot)?

I presume there is one instance of WindowManagerImpl per app process.

Something which is puzzling to me is that something called
PhoneWindowManager makes calls directly on WindowManagerImpl, for
instance when a new window is created, it calls
WindowManagerImpl.addView() which ultimately results in a ViewRoot
being crated which then notifies WindowManagerService about its

But PhoneWindowManager is created by WindowManagerService running in
its own thread, in other words the system process...  How can it make
direct calls on WindowManagerImpl, if WindowManagerImpl is executing
in applciation processes?

Obviously I am sadly mistaken about one or more fundamental aspects or
Android, but I am having a hard time tracking down any material to
make things more clear.




3. Android SDK 1.0 Port to PXA270 Init Seg Fault

4. How to rotate my view

5. Why is the market listing my app as exactly twice the size of the APK I uploaded?

6. Long click on Button

7. Why is the market listing my app as exactly twice the size of the APK I uploaded?