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. sample browser plugin not working in android sdk emulator

Hi All,

     My sample browser plugin working in emulator which is being built
from mydroid package(Android source pakage). The same library is  not
working in android sdk emulator(The sdk version is 1.1).

    Please tell me the reason for this. How can I make it work in
emulator coming up with sdk.


2. Android Emulator Orientation on Macbook

I know I've seen this question asked, but none of the answers seem to

I have a Macbook (not a MacbooPro) without numeric keypad, and I'm
perplexed as to how to change the orientation of the emulator when it
starts from Eclipse.

The key combinations in the SDK docs do not seem to apply to this

Any help is appreciated.


3. pseudotarget of android build

4. Any idea on what is "scheduleBroadcast" in Surface Flinger ?

5. how to stay animation result in view?

6. How Do you enter a negative number into an EditText

7. How to get a view from a custom layout ?