Friday, 26 February 2016

Use of Cursors in Content Providers in Android

Cursors: This interface provides random read-write access to the result set returned by a database query.

Cursor Adapters: This adapter exposes data from a Cursor to a ListView Widget.

Code

public class MainActivity extends ListActivity {
/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Uri allContacts = Uri.parse(“content://contacts/people”);
Cursor c = managedQuery(allContacts, null, null, null, null);


No comments:

Post a Comment