Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

speed up populating listview

$
0
0

how to use this code for SQL Server 2008 : SQLiteDatabase db = this.getReadableDatabase(); MatrixCursor mcursor = db.rawQuery(selectQuery, null);

i wanna directly insert data for datatable to MatrixCursor without using mcurosr.addrow

cause i am returning about 10000 records with 4 columns (from my sql server 2008). this is my code: how to do that to speed up populating listview :


DataTable _dtHesabGrid=_DB.GetAllDataTable();
                
gvHesab = FindViewById(Resource.Id.gvHesabList);

String[] columnNames = Resources.GetStringArray(Resource.Array.gvHesabHeader);

MatrixCursor cursor = new MatrixCursor(columnNames);

String[] array = Resources.GetStringArray(Resource.Array.gvHesabHeader);

String[] matrix = Resources.GetStringArray(Resource.Array.gvHesabHeader);
cursor = new MatrixCursor(matrix);
               
for (int i = 0; i < _dtHesabGrid.Rows.Count; i++)
{

cursor.AddRow(new Java.Lang.Object[] { clsBase.convertObjectToString(_dtHesabGrid.Rows[i]["HesabKolTitle"]), clsBase.convertObjectToString(_dtHesabGrid.Rows[i]["HesabKolFatherTitle"]), clsBase.convertObjectToString(_dtHesabGrid.Rows[i]["FullName"]), clsBase.convertObjectToString(_dtHesabGrid.Rows[i]["Code"]), i + 1, clsBase.convertObjectToString(_dtHesabGrid.Rows[i]["ID"]) });
                   
                }
               
                String[] from = Resources.GetStringArray(Resource.Array.gvHesabHeader);

                int[] to = { Resource.Id.txt_HesabListGrid_HesabMoen,
                             Resource.Id.txt_HesabListGrid_HesabKol ,Resource.Id.txt_HesabListGrid_Hesab,
                             Resource.Id.txt_HesabListGrid_CodeHesab,Resource.Id.txt_HesabListGrid_Row,Resource.Id.txt_HesabListGrid_Id};

SimpleCursorAdapter _HesabGridAdapter = new SimpleCursorAdapter(this, Resource.Layout.HesabListGrid, cursor, from, to);
                


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>