SQlite to 2 line multiple choice list view

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

SQlite to 2 line multiple choice list view

Postby luthepa1 » Tue Dec 01, 2009 6:45 am

Ok I am trying something a little out of my reach being that I am new to android/java.

Currently I have code to open a database of mine and read out into a Toast text view for testing purposes. For example;
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.     public void DisplayExercise(Cursor c)
  3.  
  4.     {
  5.  
  6.         Toast.makeText(this,
  7.  
  8.                 "id: " + c.getString(0) + "\n" +
  9.  
  10.                 "Name: " + c.getString(1) + "\n" +
  11.  
  12.                 "Note: " + c.getString(2) + "\n" +
  13.  
  14.                 "Category: " + c.getString(3) + "\n" +
  15.  
  16.                 "Cardio:  " + c.getString(4).toString(),
  17.  
  18.                 Toast.LENGTH_LONG).show();        
  19.  
  20.     }
  21.  
  22.    
  23.  
  24.     private void displayAllExercises() {
  25.  
  26.         //---get all titles---
  27.  
  28.         mDbHelper.open();
  29.  
  30.         Cursor c = mDbHelper.fetchAllExercises();
  31.  
  32.         if (c.moveToFirst())
  33.  
  34.         {
  35.  
  36.             do {          
  37.  
  38.                 DisplayExercise(c);
  39.  
  40.             } while (c.moveToNext());
  41.  
  42.         }
  43.  
  44.         mDbHelper.close();
  45.  
  46.     }
  47.  
  48.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


but what I want to do now is put the cursor data into a multiple choice list view, but with each item/view as a 2 line view to show the title and the 2nd line to show the category. Can anybody help point me in the right direction of show me some sample code that could help me or give me direction? I would really appreciate any help.

Thanks,

DrP.
luthepa1
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Oct 14, 2009 11:51 pm

Top

Postby luthepa1 » Tue Dec 01, 2009 1:26 pm

Well jsut had major break through. I now have my code load the data from a table in my DB into a list view I created in the designer with multiple choice. Now just need to add the 2 lines per view but I should eb able to pick that up now. Starting to get eh hang of android/java now. :D
luthepa1
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Oct 14, 2009 11:51 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 6 guests