SimpleCursorAdapter and ListActivity
package app.test;
import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Contacts.People;
import android.widget.SimpleCursorAdapter;
public class Test extends ListActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Cursor c = managedQuery(People.CONTENT_URI,
null, null, null, People.NAME);
String[] cols = new String[]{People.NAME};
int[] views = new int[] {android.R.id.text1};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1,
c, cols, views);
this.setListAdapter(adapter);
}
}
Related examples in the same category