!- I GIVE UP -! Update Listview in the Background

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

!- I GIVE UP -! Update Listview in the Background

Postby guruk » Mon Mar 16, 2009 8:15 pm

Hi,
I search now for Days for this Solution and nearly give up.
It cant be so complicated, also YouTube APP works in this simple way.

When we like to update the Listview with Data from the Net we can preload it
and if there is more data like Pics we have to say "LOADING", till its finished and
than show the Listview

OR

We show the GUI instantly and than load the Data step by step into the Listview.
Exactly this I like to solve since Days.. AND NEARLY GIVE UP.

Please help, with a Tutorial or any practical Script.

... I initiate my Listview
... Open a Thread and load the Data (Gui is already visible)
... Update the Listview

Some People told me to use notifyDataSetChanged(), but in practice the command
is not recognized when I place it in my source.

Please HELP !

Thanks
Chris
guruk
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Mar 08, 2009 8:05 pm

Top

Postby Alexandro » Wed Mar 18, 2009 1:49 pm

I didn't really understood your problem.
If you load data somewhere in the other thread asynchronously, you can send messages to your UI thread with android.os.Handler. If you got some data chunk you send message to your UI thread that ListView needs to be updated and call the corresponding method.
If that's your problem.
Alexandro
Junior Developer
Junior Developer
 
Posts: 24
Joined: Thu Mar 05, 2009 5:42 pm

Postby guruk » Wed Mar 18, 2009 2:05 pm

I got it already!

thanks .. just to share:

Yes I loaded in the background with a thread and when i tried to update the gui it was not able.

Some Helpers told me to: notifyDataSetChanged();..
but I even was unable to implement this Command in my Gui Thread.

Till I found out that I have to make an object to my EfficiencyAdapter:

EfficientAdapter mAdapter;
...
mAdapter = new EfficientAdapter(this);
setListAdapter(mAdapter);

and so I was able to write in my Gui Thread:
mAdapter.notifyDataSetChanged(),

And now it works perfect :)

Thanks for your Interest to help

Greets
Chris
guruk
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Mar 08, 2009 8:05 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests