setListAdapter

Put your problem here if it does not fit any of the other categories.

setListAdapter

Postby s1nn0n » Wed Aug 26, 2009 10:54 pm

Hi all, I was referencing the Notepad example whilst implementing database support into my app, and im having trouble with
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. setListAdapter(notes);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


It tells me in eclipse that the setListAdapter(setCursorAdapter) is undefined for the type goJar

As a quick fix it creates

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         private void setListAdapter(SimpleCursorAdapter notes) {
  2.  
  3.                 // TODO Auto-generated method stub
  4.  
  5.                
  6.  
  7.         }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


I have noticed that on my public class it extends Acitivity where as on the example app it extends ListActivity, could this be part of the problem?

It compiles fine when I accept the quick fix, it just doesnt fill the ListView.

Heres a further part of the code in case you need it

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.     private void fillData() {
  2.  
  3.         // Get all of the notes from the database and create the item list
  4.  
  5.         Cursor c = mDbHelper.fetchAllEntries();
  6.  
  7.         startManagingCursor(c);
  8.  
  9.  
  10.  
  11.         String[] from = new String[] { DbAdaptor.KEY_TITLE };
  12.  
  13.         int[] to = new int[] { R.id.text1 };
  14.  
  15.        
  16.  
  17.         // Now create an array adapter and set it to display using our row
  18.  
  19.         SimpleCursorAdapter notes =
  20.  
  21.             new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
  22.  
  23.         setListAdapter(notes);
  24.  
  25.  
  26.  
  27.     }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4



Thanks!
s1nn0n
Freshman
Freshman
 
Posts: 4
Joined: Wed Aug 26, 2009 10:44 pm

Top

Postby sachendra » Tue Oct 06, 2009 2:25 pm

SetListAdapter is a method of ListView class. SO make sure that either you are extending listActivity or call this method by an object of listview.

cheers
Sachendra Singh Rathore
s.sachendra@live.in
Android aplication developer
sachendra
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Mar 18, 2009 12:25 pm
Location: Mumbai

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 20 guests