I had written some code for this like:
First I had created one TreeSet object as:
TreeSet ts = new TreeSet<String>();
public void checkExist()
{
if (ts.add(tokens[5]))
{
System.out.println ("Record is not exist");
showView(tokens);
}
else
{
System.out.println ("SciptId is already exist");
System.out.println (scriptCode.getText());
name.setText(tokens[2]);
emp.setText(tokens[4]);
MobNo.setText(tokens[5]);
}
}
public void showView(String[] tokens)
{
// get a reference for the TableLayout
TableLayout table = (TableLayout)
findViewById(R.id.tableLayout);
TableRow row = new TableRow(this);
// create a new TextView
Name = new TextView(this);
empId = new TextView(this);
MobNo= new TextView(this);
// create a new TableRow
// set padding
Name.setPadding(6,6,6,6);
empId.setPadding(6,6,6,6);
MobNo.setPadding(6,6,6,6);
Name.setText(tokens[2]);
empId.setText(tokens[4]);
MobNo.setText(tokens[5]);
row.addView(Name);
row.addView(empId);
row.addView(MobNo);
table.addView(row,new
TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
}
But here is problem is that if first three records are new then it is
ok, But suppose there is change in records then all changes are
updated in last rows . But what I want is changes are made in that
particular record . Means suppose data is like
Name empId MobNo
Pramod 123 12334
Tom 345 456465
Harry 345 546
and now there is changes in Mob no of Pramod then table view must be
like:
Name empId MobNo
Pramod 123 78978
Tom 345 456465
Harry 345 546
But using above code I got output as:
Name empId MobNo
Pramod 123 12334
Tom 345 456465
Pramod 123 78978
Any Idea or suggestion? Thanks
On May 23, 2:58 pm, "pramod.deore" <[email protected]> wrote:
> Hi to all, I am deveolping one application in that I am getting
> continous data from server, now I want to show this data in table
> format. like
>
> Name empId MobNo
> Pramod 123 12334
> Tom 345 456465
> Harry 345 546
>
> I am able to show data like this. But the challange is if suppose
> server send data from Pramod again then it must override old value and
> it look like
>
> Name empId MobNo
> Pramod 123 78978
> Tom 345 456465
> Harry 345 546
>
> And if new record received then it must add new row as
>
> Name empId MobNo
> Pramod 123 12334
> Tom 345 456465
> Harry 345 546
> Rob 4554 465456
>
> How to do this? Any response is appriciated. 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 [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-developers?hl=en