You have to change the data structure that stores the data for the
listView and then call notifyDataSetChange();
Let;s say you are using and ArrayList<String> lst, you would do
something like this:
public void getRemoteData() {
// .. get data and put it in the array list
adapter.notifyDataSetChange();
}
And, it will update itself.
Hope it made sense and helped :)
- Moazzam
http://moazzam-khan.com/
On Aug 21, 1:31 pm, "Yusuf Saib (T-Mobile USA)" <yusuf.s...@t-
Mobile.com> wrote:
> What is the adapter class? For an ArrayAdapter, you don't need to call
> notifyDataSetChanged() unless you called setNotifyOnChange(false).
>
> Yusuf Saib
> Android
> ·T· · ·Mobile· stick together
> The views, opinions and statements in this email are those of the
> author solely in their individual capacity, and do not necessarily
> represent those of T-Mobile USA, Inc.
>
> On Aug 20, 5:40 am, Liviu Ungureanu <[email protected]> wrote:
>
> > Hi all!
> > I have a ListView with and adapter extended from BaseAdapter.
> > I insert some data in my list but when i try to insert an other item in list
> > nothing happend.
> > Can someone give me a ideea about updating listview data?
>
> > this is the code:
>
> > //<insertData>
> > info_list.setCacheColorHint(Color.WHITE);
> > info_list.setSelector(R.drawable.list_item_border);
>
> > ItemInfo phone = new
> > ItemInfo(this,R.drawable.phone,"Phone",item.getPhoneFormatted());
> > ItemInfo address = new
> > ItemInfo(this,R.drawable.address,"Address",item.getAddress());
> > ItemInfo e_mail = new
> > ItemInfo(this,R.drawable.email,"E-mail",formatTextV2(item.getEMail()));
> > ItemInfo web_site = new
> > ItemInfo(this,R.drawable.website,"Website",formatTextV2(item.getWebSite()))
> > ;
> > ItemInfo category = new
> > ItemInfo(this,R.drawable.category,"Category",item.getCategory());
>
> > adapter.addItemInfo(phone);
> > adapter.addItemInfo(address);
> > adapter.addItemInfo(e_mail);
> > adapter.addItemInfo(web_site);
> > adapter.addItemInfo(category);
>
> > info_list.setAdapter(adapter);
> > //</insertData>
>
> > //<updateData>
>
> > button_prev.setOnClickListener(new OnClickListener()
> > {
> > @Override
> > public void onClick(View arg0) {
>
> > Item item_received = ResultsActivity.getItemAt(current_index--);
> > int i;
> > adapter.update(0,item.getPhoneFormatted());
> > adapter.addItemInfo(new
> > ItemInfo(TestActivity.this,R.drawable.address,"Address",formatTextV2(item.g
> > etAddress())));
> > adapter.addItemInfo(new
> > ItemInfo(TestActivity.this,R.drawable.email,"E-mail",formatTextV2(item.getE
> > Mail())));
> > adapter.addItemInfo(new
> > ItemInfo(TestActivity.this,R.drawable.website,"Website",formatTextV2(item.g
> > etWebSite())));
> > adapter.addItemInfo(new
> > ItemInfo(TestActivity.this,R.drawable.category,"Category",item.getCategory(
> > )));
> > adapter.notifyDataSetChanged();
> > }
> > });
> > //</updateData>
>
> > Thank you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---