Hi all, I am developing an application in that I am receiving
continous data through socket. Now I want to display this data in list
view. Suppose I got data of 3 records and I am showing this data in
listview as

EmpName    EmpId     MobNo
Pramod           12        789
Tom                11        456
Harry               45       123


Now suppose record for Pramod changes now it must be visible as

EmpName    EmpId     MobNo
Pramod           22        723
Tom                11        456
Harry               45       123


Here Name will never change only other filed will change. Now I want
to check whether EmpName is exist or not if Name is already exist then
update other filed of that record and if Name is not exist then create
new row.

I had tried something like this as:

TreeSet ts = new TreeSet<String>();
.....
......

if(ts.add(tokens[5]))   //I am checking this for record is exist or
not? If record is not exist then create row.But I am not able to write
else part where if record existed but I want to update that row.
{
     showList();
}

public void showList()
{

        mylist = new ArrayList<HashMap<String, String>>();
        map = new HashMap<String, String>();
        map.put("Name", tokens[2]);
        map.put("EmpId", tokens[4]);
        map.put("MobNo", tokens[5]);


                mylist.add(map);

        SimpleAdapter mSchedule = new SimpleAdapter(this, mylist,
R.layout.listcolumns,
                                    new String[] {"Name", "EmpId", "MobNo"}, 
new int[]
{R.id.Name, R.id.EmpId, R.id.MobNo});
        list.setAdapter(mSchedule);
}

But using this it create only one row. Please help me to solve this
issue. Thanks in advance.

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