Hi thanks for your fast answer. Unfortunately I was on the road, so i
reply so late.
Your suggestion seems to be right (my ListView show the new data). But
i doesn't see an empty list before. It seems, that the activity wait,
until my thread is ready.... I dont know why:

public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.xxx);

        progress = ProgressDialog.show(this, "yyy", "zzzz",
true,false);
        fileList = getIntent().getStringArrayExtra("fileList");
        pos = getIntent().getIntExtra("pos", -1);
        arrayindex=0;

        trackpoint = Trackpoint.getInstance();
        waypoint = Waypoint.getInstance();

        test = new ArrayList <String>();

        setupTab();       //test is empty!!!
    }

public void setupTab ()
    {
        tabs = (TabHost)findViewById(R.id.aaa);

        tabs.setup();
        TabHost.TabSpec ts=tabs.newTabSpec("list");

        lv=(ListView)findViewById(R.id.list);
        ts.setContent(new TabHost.TabContentFactory(){
            public View createTabContent(String tag)
            {
                my_adapter = new MyAdapter(xxx.this);
                lv.setAdapter(my_adapter);
                return lv;
            }
        });

        ts.setIndicator("Listenansicht");
        tabs.addTab(ts);

        ts = tabs.newTabSpec("ll");
        ts.setContent(R.id.ll);
        ts.setIndicator("Kartenansicht");
        tabs.addTab(ts);
        tabs.setCurrentTab(0);
    }

I implement an observer pattern and if i get all waypoints, i add them
to the arrayList:

test.addAll(wp.getDescription());

But i only see the ListView with the updated data (and no empty
list).


Why dont i see the empty list before?? (my example only reads 5
waypoints out of a xml file, but the loading time of the activity
seems to be long;  before i see my tabs)


Thanks,
Stefan

On Nov 5, 1:35 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> Stefan wrote:
> > Hi Mark, hi @all,
>
> > i saw Mark M. example (http://www.androidguys.com/2008/07/28/fancy-
> > listviews-part-five/ ) and test it. This is really good. But i have
> > one problem:
> > After i start the app, i want to see my GUI (one Tab content is a
> > ListView, the second and last Tab is a MapView). In a background
> > thread, i want (and i can) load the data for the listView.
>
> > So i first create the Tab with the ListView without any content (my
> > string array is empty: String [] array = {""}; ).
>
> Don't do that if you want to modify the contents of the ArrayAdapter.
> Use an empty ArrayList<String> instead.


>
> > Now if the background thread is ready and the array-String has get the
> > data, i want to update the ListView in my tab. I try:
> >  my_adapter.notifyDataSetChanged();
> > but without success.
> > What must i do, that the ListView gets updated.
>
> Add the values to the ArrayAdapter via add(). The ListView will update
> automatically.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Consulting/App Development:http://commonsware.com/consulting

-- 
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