sathish v

sathish v

  • NA
  • 323
  • 2k

List sqlite database Table in xamarin.android

Jul 27 2018 7:41 AM
  1.  
I Want To List All Tables in sqlite database table,

When i tries to List the table contents It Only Shows the First columns of table.

AXML Page:;

 
  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  2. android:orientation="vertical"  
  3. android:layout_width="match_parent"  
  4. android:layout_height="match_parent">  
  5. <ListView  
  6.   android:layout_width="fill_parent"  
  7.     android:layout_height="wrap_content"  
  8.    android:layout_marginTop="0dp"  
  9.   android:clickable="true"  
  10.   android:divider="#b5b5b5"  
  11.   android:dividerHeight="1dp"  
  12.     android:id="@+id/listView1" /> 
 ANd CS Page
 
  1. string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "BookmarkSqlite.db3");    
  2.         var db = new SQLiteConnection(dpPath);  
  3.           var data = db.Table<BookmarkSqliteTable>();   
  4.   
  5.   
  6.         foreach (var listing in data)  
  7.   
  8.         {  var from = new string[]{ listing.SiteName + "----" + listing.SiteUrl };   
  9.   
  10.             //var from = fromm.ToList();  
  11.   
  12.             ListView listtable = (ListView)FindViewById(Resource.Id.listView1);  
  13.             listtable.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, from);  
  14.         }  
  15.   
  16.     } 
 i tried ToList on from,but it also not works
 
  1. listtable.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, from.ToList());
  2.  

Answers (1)