Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - add table rows after table loading
    primarykey
    data
    text
    <p>I am reading UDP packets and i wanna display that info on UI as table in android app. Here is my code,</p> <pre><code> try { byte buffer[] = new byte[10000];&lt;br/&gt; InetAddress address = InetAddress.getByName("192.168.xx.xx");&lt;br/&gt; int port = xxx;&lt;br/&gt; Log.d("..........","What will Happen ?? ");&lt;br/&gt; for(int k=0;k&lt;50;k++) { // 50 rows are added , This i wanna make it 5000+ rows so it takes plenty of time to load that table &lt;br/&gt; DatagramPacket p = new DatagramPacket(buffer, buffer.length, address, port);&lt;br/&gt; DatagramSocket ds = new DatagramSocket(port);&lt;br/&gt; Log.d("..........","Perfect Binding .... Waiting for Data");&lt;br/&gt; ds.receive(p);&lt;br/&gt; Log.d("..........","Packet Received");&lt;br/&gt; byte[] data = p.getData();&lt;br/&gt; String result = "";&lt;br/&gt; int b[] = new int[data.length];&lt;/br&gt; for (int i=0; i &lt; 150; i++) {&lt;br/&gt; result += Integer.toString( ( data[i] &amp; 0xff ) + 0x100, 16).substring( 1 );&lt;br/&gt; result += "_";&lt;br/&gt; }&lt;br/&gt; Log.d("Result =&gt; ",result); &lt;br/&gt; TableLayout tl=(TableLayout)findViewById(R.id.TableLayout01);&lt;br/&gt; TableRow tr=new TableRow(this); TextView tv= new TextView(this); TextView tv2 = new TextView(this); tv.setPadding(5, 0, 5, 0); tv2.setPadding(5,0,5,0); String k1 = Integer.toString(k); tv.setText(k1); tv2.setText(it_version); tr.addView(tv); tr.addView(tv2); tl.addView(tr,1); ds.close(); } } catch (Exception e) { Log.e("UDP", "Client error", e); } </code></pre> <p>If i keep 50 rows am able to display it properly without any time delay, if i put 3000 rows its taking too long time and sometimes app is hanging... I wanna add 50 entries to a table and load the table and again read 50 entries and append to the table without touching any button or anything so i have a table in UI and it will update automatically by reading UDP packets ... how i can achieve that ?? Any clue appreciated.</p> <p>or once i read the UDP packet i wanna display it on UI[appending to the table],How i can do this ??[Scrolling and all i will take care] please let me know <em>I already tried using threads but no use</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload