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. Integrate your own application into the Maps application


My question is: "Is it possible to alter the standard Maps application
on Android in such a way that it is able to show for example some
specific POIs on the map"

Google Latidude enhances Google Maps for its purposes in this way.

So is it possible for a developer outside of Google to enhance the Map
application too?

I have searched for the source of the Map application but did not
found anything. Is this part not Open Source?

thx for your answers


2. handling events (click, tap, touch) for map (mapview, mapactivity)


could anyone point me to some documentation or code on what's "the
official" way to handle events on a mapview or within a mapactivity? I
have searched around, there seem to be lots of questions regarding
this issue, few answers, and every answer is different.
As an example, I want to do something similar to the MyTracks
application: on a touch on the map, the builtin zoomcontrols appear,
panning still works, and in addition, other controls (the next/prev)
buttons are shown.

It seems I cannot achieve the desired effect using standard event
handlers, e.g. I could not get it to work by setting an
onClickListener or onTouchListener and implementing onClick()/onTouch

What is not clear to me:
- do I have to go directly to using overlays to achieve such an
effect? I understood overlays are more intended to display data on
maps, as opposed to controls?
- do I have to subclass mapview or mapactivity or both?
- is there a way without extending mapview, mapactivity and just
employing the standard event handling interface?



3. Resizing an image

4. listview click problem

5. How to add a new text language in my Android when not included?

6. No one ever answer my posts !!!!

7. Porting RDP (Remote Desktop Protocol) to Android -- questions