Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Android
  4. How to speed up the populating of listview

How to speed up the populating of listview

Scheduled Pinned Locked Moved Android
androiddatabasesqliteperformancetutorial
2 Posts 1 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 9427106
    wrote on last edited by
    #1

    Hi, I am populating my listview from Sqlite (sometime also from DataTable) 1. when the data is huge its very slow ? 2. how to have filter for this with high speed ?(same as contact list ) Thanks in advanced ! For filtering i have seen this code :

    _adapter.Filter.InvokeFilter(_inputSearch.Text);

    but just work for one column :

    _adapter = new ArrayAdapter<string>(this, Resource.Layout.list_item, Resource.Id.product_name, products);

    No USE At ALL !!!! my code :

    protected override void OnCreate(Bundle bundle)
    {
    base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.HesabList);
    
            progress = ProgressDialog.Show(this, "", "Loading ...");
            progress.SetProgressStyle(ProgressDialogStyle.Spinner);
            progress.Indeterminate = true;
            new Thread(new ThreadStart(delegate
            {
                \_btnUpdate = FindViewById<Button>(Resource.Id.UpdateHesabList);
                \_btnUpdate.Click += new EventHandler(\_btnUpdate\_Click);
                gvHesab = FindViewById<ListView>(Resource.Id.gvHesabList);
                gvHesab.ItemClick += new EventHandler<AdapterView.ItemClickEventArgs>(gvHesab\_ItemClick);
                isTarafHesab = Intent.GetBooleanExtra("IsTarafHesab", false);
                txtSearchHesabList = (EditText)FindViewById(Resource.Id.txtSearchHesabList);
                txtSearchHesabList.TextChanged += new EventHandler<Android.Text.TextChangedEventArgs>(txtSearchHesabList\_TextChanged);
                txtSearchHesabList.Gravity = GravityFlags.Right;
    
                Looper.Prepare();
                File dbtest = new File(clsBase.SqliteDBPath);
                
                if (!dbtest.Exists() )
                {
    
                    if (clsBase.HasInternetConnection(this))
                        createDbSqlite();
                    else
                    {
                        MessageBoxAndroid.Show(this, "Connect to Internet First !");
                        Finish();
                    }
                }
                else
                {
                     fillListView();
                 }
    
                RunOnUiThread(() => progress.Dismiss()); 
           })).Start();
            
        }
    

    private void fillGridView()
    {
    try
    {
    SQLiteDatabase db = OpenOrCreateDatabase("test

    U 1 Reply Last reply
    0
    • U User 9427106

      Hi, I am populating my listview from Sqlite (sometime also from DataTable) 1. when the data is huge its very slow ? 2. how to have filter for this with high speed ?(same as contact list ) Thanks in advanced ! For filtering i have seen this code :

      _adapter.Filter.InvokeFilter(_inputSearch.Text);

      but just work for one column :

      _adapter = new ArrayAdapter<string>(this, Resource.Layout.list_item, Resource.Id.product_name, products);

      No USE At ALL !!!! my code :

      protected override void OnCreate(Bundle bundle)
      {
      base.OnCreate(bundle);

              // Create your application here
              SetContentView(Resource.Layout.HesabList);
      
              progress = ProgressDialog.Show(this, "", "Loading ...");
              progress.SetProgressStyle(ProgressDialogStyle.Spinner);
              progress.Indeterminate = true;
              new Thread(new ThreadStart(delegate
              {
                  \_btnUpdate = FindViewById<Button>(Resource.Id.UpdateHesabList);
                  \_btnUpdate.Click += new EventHandler(\_btnUpdate\_Click);
                  gvHesab = FindViewById<ListView>(Resource.Id.gvHesabList);
                  gvHesab.ItemClick += new EventHandler<AdapterView.ItemClickEventArgs>(gvHesab\_ItemClick);
                  isTarafHesab = Intent.GetBooleanExtra("IsTarafHesab", false);
                  txtSearchHesabList = (EditText)FindViewById(Resource.Id.txtSearchHesabList);
                  txtSearchHesabList.TextChanged += new EventHandler<Android.Text.TextChangedEventArgs>(txtSearchHesabList\_TextChanged);
                  txtSearchHesabList.Gravity = GravityFlags.Right;
      
                  Looper.Prepare();
                  File dbtest = new File(clsBase.SqliteDBPath);
                  
                  if (!dbtest.Exists() )
                  {
      
                      if (clsBase.HasInternetConnection(this))
                          createDbSqlite();
                      else
                      {
                          MessageBoxAndroid.Show(this, "Connect to Internet First !");
                          Finish();
                      }
                  }
                  else
                  {
                       fillListView();
                   }
      
                  RunOnUiThread(() => progress.Dismiss()); 
             })).Start();
              
          }
      

      private void fillGridView()
      {
      try
      {
      SQLiteDatabase db = OpenOrCreateDatabase("test

      U Offline
      U Offline
      User 9427106
      wrote on last edited by
      #2

      For filtering i have seen this code :

      _adapter.Filter.InvokeFilter(_inputSearch.Text);

      but just work for one column :

      _adapter = new ArrayAdapter<string>(this, Resource.Layout.list_item, Resource.Id.product_name, products);

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups