use of android.widget.SimpleCursorAdapter in project cw-android by commonsguy.
the class ConstantsBrowser method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db = new DatabaseHelper(this);
constantsCursor = db.getReadableDatabase().rawQuery("SELECT _ID, title, value " + "FROM constants ORDER BY title", null);
ListAdapter adapter = new SimpleCursorAdapter(this, R.layout.row, constantsCursor, new String[] { DatabaseHelper.TITLE, DatabaseHelper.VALUE }, new int[] { R.id.title, R.id.value });
setListAdapter(adapter);
registerForContextMenu(getListView());
}
use of android.widget.SimpleCursorAdapter in project cw-advandroid by commonsguy.
the class OldContactsAdapterBridge method buildPhonesAdapter.
SpinnerAdapter buildPhonesAdapter(Activity a) {
String[] PROJECTION = new String[] { Contacts.Phones._ID, Contacts.Phones.NAME, Contacts.Phones.NUMBER };
String[] ARGS = { String.valueOf(Contacts.Phones.TYPE_MOBILE) };
Cursor c = a.managedQuery(Contacts.Phones.CONTENT_URI, PROJECTION, Contacts.Phones.TYPE + "=?", ARGS, Contacts.Phones.NAME);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(a, android.R.layout.simple_spinner_item, c, new String[] { Contacts.Phones.NAME }, new int[] { android.R.id.text1 });
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
return (adapter);
}
use of android.widget.SimpleCursorAdapter in project BeyondUPnP by kevinshine.
the class PlaylistFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_playlist, container, false);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(), android.R.layout.simple_list_item_activated_1, null, new String[] { PlaylistItem.ITEM_TITLE }, new int[] { android.R.id.text1 }, 0);
mListView = (ListView) view.findViewById(android.R.id.list);
mListView.setAdapter(mAdapter);
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
mListView.setMultiChoiceModeListener(new MultipleModeCallback());
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Cursor cursor = (Cursor) mAdapter.getItem(position);
String itemUri = cursor.getString(cursor.getColumnIndex(PlaylistItem.ITEM_URI));
String metadata = cursor.getString(cursor.getColumnIndex(PlaylistItem.ITEM_METADATA));
PlaybackCommand.playNewItem(itemUri, metadata);
}
});
return view;
}
use of android.widget.SimpleCursorAdapter in project android-support-v4-googlemaps by petedoyle.
the class CursorFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(), android.R.layout.simple_list_item_2, null, new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS }, new int[] { android.R.id.text1, android.R.id.text2 }, 0);
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}
use of android.widget.SimpleCursorAdapter in project robolectric by robolectric.
the class ShadowSimpleCursorAdapterTest method testSwapCursorToNull.
@Test
public void testSwapCursorToNull() {
SimpleCursorAdapter adapter = new SimpleCursorAdapter(RuntimeEnvironment.application, 1, null, new String[] { "name" }, new int[] { 2 }, 0);
Cursor cursor = setUpDatabase();
adapter.swapCursor(cursor);
adapter.swapCursor(null);
assertThat(adapter.getCursor()).isNull();
}
Aggregations