Hi, all I am parsing one string and showing data in table layout format. But only one record is visible and other are not.
Here is my xml file: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <HorizontalScrollView xmlns:android="http://schemas.android.com/ apk/res/android" android:layout_width="320px" android:layout_height="fill_parent"> <TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" > <TableRow> <TextView android:text="Date" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:text="Order Ref" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:text="Exch" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:text="St" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:text="Buy/Sell" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:text="Qty" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:text="Price" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:text="Status" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </TableRow> <TableRow> <TextView android:id="@+id/date" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/orderRef" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/exch" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/st" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/buysell" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/qty" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/price" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/status" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </TableRow> </TableLayout> </HorizontalScrollView> </LinearLayout> and my activity is like: public class TableLayoutTest extends Activity { TextView date,orderRef,exch,st,buysell,qty,price,status; String[] temp; String del = "[|$^]+"; String[] tokens ; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); date = (TextView)findViewById(R.id.date); orderRef = (TextView)findViewById(R.id.orderRef); exch = (TextView)findViewById(R.id.exch); st = (TextView)findViewById(R.id.st); buysell = (TextView)findViewById(R.id.buysell); qty = (TextView)findViewById(R.id.qty); price = (TextView)findViewById(R.id.price); status = (TextView)findViewById(R.id.status); String str = "0|$8542042042|^QWE|^ASDFG|^B|^M|^T|^1065.55|^C| ^E|^20-Apr-2010 10:58|^19-Apr-2010|^20100419B100000010|^10|^0|^0|^0|^0| ^0|^0.00|^N|^0.0|^B1|^WEB|^N |^201011013|^Rolling|^ |^800.00|^| $8542042042|^QWE|^ZXCV|^B|^M|^T|^1065.55|^C|^E|^19-Apr-2010 17:12|^19- Apr-2010|^20100419B100000001|^2|^0|^0|^0|^0|^0|^0.00|^N|^0.0|^B1|^WEB| ^N |^201011013|^Rolling|^ |^800.00|^|$2011041100000388|^|$"; String delims = "[|$^]+"; tokens = str.split(delims); String sp = tokens[1]; temp = str.split(sp); System.out.println ("^^^^^^^^^^^"+temp.length); for (int i=1;i<temp.length;i++) { String spStr = "|$"+sp+temp[i]; splitThisString(spStr); } } public void splitThisString(String test) { System.out.println (":"+test); String[] tok = test.split(del); System.out.println ("!!!!!!"+tok.length); for (int j=0;j<tok.length;j++) { System.out.println (tok[j]); } date.setText(tokens[10]); orderRef.setText(tokens[12]+tokens[23]); exch.setText(tokens[2]); st.setText(tokens[3]); buysell.setText(tokens[4]); qty.setText(tokens[13]); price.setText(tokens[7]); status.setText(tokens[9]); System.out.println ("*************************************"); System.out.println (tokens.length); } } And when I run this program I get output as Date OrderRef Exch St buy/sell Qty Price Status 20-Arp-2010 20103 QWE ASDFG B 10 1089 E But I want output as: Date OrderRef Exch St buy/sell Qty Price Status 20-Arp-2010 20103 QWE ASDFG B 10 1089 E 20-Arp-2010 20103 QWE ASDFG B 10 1089 E Here number of rows are can vary from 0-n. Then How to add other Row? (Here I took output values are different from actual output) -- 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

