Best way to display Stream data in Android Listview

We are trying to show table data in a list. The data consists of 8 columns and about 50 rows. During one second period, approximately 8 updates are received. (that is: update row2-column5 to something.) Each time new data appears, we update the selected cells and call the datasetchanged() and this causes some performance and scrolling problems.

My question is:
What is the best way to display stream data on Android using standard widgets?

+6
source share
2 answers

You can try updating only those items that need updating. To do this, you need the position of the data in the list.

 private void updateData(int position) { int firstItem = listView1.getFirstVisiblePosition(); View view = listView1.getChildAt(position - firstItem); TextView tv = (TextView)view.findViewById(R.id.textview); tv.setText("Example Text"); } 
+2
source

I would either write my own Cursor and connect it to the CursorAdapter and AdapterView, or ... just use the MatrixCursor . MatrixCursor allows you to add a new row. You can then call onChange() to notify you of data changes.

0
source

Source: https://habr.com/ru/post/892982/


All Articles