本文整理汇总了Java中android.widget.SimpleCursorAdapter.setDropDownViewResource方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleCursorAdapter.setDropDownViewResource方法的具体用法?Java SimpleCursorAdapter.setDropDownViewResource怎么用?Java SimpleCursorAdapter.setDropDownViewResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.SimpleCursorAdapter
的用法示例。
在下文中一共展示了SimpleCursorAdapter.setDropDownViewResource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add_insulin_log);
title(getString(R.string.new_insulin_record));
insulinLogDao = new InsulinLogDao(this);
insulinTypeDao = new InsulinTypeDao(this);
Button cancelButton = (Button)findViewById(R.id.InsulinLogCancelButton);
Button submitButton = (Button)findViewById(R.id.InsulinLogSubmitButton);
cancelButton.setOnClickListener(cancelButtonOnClickListener);
submitButton.setOnClickListener(submitButtonOnClickListener);
try{
insulinTypeDao.openToRead();
Cursor cursor = insulinTypeDao.queueAll();
String [] field = new String [] {InsulinTypeDao.NAME_FIELD_NAME};
int [] viewId = new int [] {R.id.InsulinTypeTextView};
@SuppressWarnings("deprecation")
SimpleCursorAdapter simpleCursorAdapter = new SimpleCursorAdapter(this, R.layout.insulin_type_spinner_template, cursor, field, viewId);
simpleCursorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner insulinTypeSpinner = (Spinner)findViewById(R.id.InsulinTypeSpinner);
insulinTypeSpinner.setAdapter(simpleCursorAdapter);
} finally {
insulinTypeDao.close();
}
}
示例2: adjustCategorySpinner
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
private void adjustCategorySpinner(int catID) {
// Cursor cursorAllCat = mDbHelper.fetchAllCategories();
Cursor cursorAllCat = getCategoriesCursor();
// loop over all categories to find the position for the current
// category id
cursorAllCat.moveToFirst();
int position = 1;
do {
if (cursorAllCat.getInt(0) == catID)
break;
cursorAllCat.moveToNext();
position++;
} while (!cursorAllCat.isLast());
String[] columns = new String[] { CategoriesTable.CATEGORIES_KEY_NAME };
int[] to = new int[] { android.R.id.text1 };
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this.getActivity(),
android.R.layout.simple_spinner_item, cursorAllCat, columns, to);
mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
categorySpinner.setAdapter(mAdapter);
categorySpinner.setSelection(position - 1);
}
示例3: onLoadFinished
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
String[] adapterCols = {TrucksOwnedByUserQuery.PROJECTION[TrucksOwnedByUserQuery.NAME]};
int[] adapterRowViews = new int[]{android.R.id.text1};
spinnerAdapter = new SimpleCursorAdapter(getSupportActionBar().getThemedContext(),
android.R.layout.simple_spinner_item, cursor, adapterCols, adapterRowViews, 0);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
actionBarSpinner.setAdapter(spinnerAdapter);
if (spinnerAdapter.getCount() > 0) {
actionBarSpinner.setSelection(0, true);
}
}
示例4: populateSpinnerStudent
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
private void populateSpinnerStudent(DBAdapter mDbHelper, long courseId) {
Cursor c = mDbHelper.allStudents(courseId);
if (c.getCount() == 0) {
new AlertDialog.Builder(this)
.setTitle(getString(R.string.error))
.setMessage(getString(R.string.error_no_students))
.setNeutralButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
finish();
overridePendingTransition(R.anim.leave_1,
R.anim.leave_2);
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.setCancelable(false).show();
}
String[] from = new String[] { DBAdapter.S_FIRST_NAME, DBAdapter.S_LAST_NAME};
int[] to = new int[] { R.id.row_exam_student_spinner_text1,
R.id.row_exam_student_spinner_text2 };
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.row_exam_student_spinner, c, from, to);
adapter.setDropDownViewResource(R.layout.row_exam_student_spinner);
spinnerStudent.setAdapter(adapter);
}
示例5: onCreate
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mApp = (ImApp)getApplication();
mHandler = new SimpleAlertHandler(this);
resolveIntent(getIntent());
setContentView(R.layout.add_contact_activity);
BrandingResources brandingRes = mApp.getBrandingResource(mProviderId);
setTitle(brandingRes.getString(BrandingResourceIDs.STRING_ADD_CONTACT_TITLE));
TextView label = (TextView) findViewById(R.id.input_contact_label);
label.setText(brandingRes.getString(BrandingResourceIDs.STRING_LABEL_INPUT_CONTACT));
mAddressList = (MultiAutoCompleteTextView) findViewById(R.id.email);
mAddressList.setAdapter(new EmailAddressAdapter(this));
mAddressList.setTokenizer(new Rfc822Tokenizer());
mAddressList.addTextChangedListener(mTextWatcher);
mListSpinner = (Spinner) findViewById(R.id.choose_list);
Cursor c = queryContactLists();
int initSelection = searchInitListPos(c,
getIntent().getStringExtra(ImServiceConstants.EXTRA_INTENT_LIST_NAME));
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_spinner_item, c, new String[] { Imps.ContactList.NAME },
new int[] { android.R.id.text1 });
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mListSpinner.setAdapter(adapter);
mListSpinner.setSelection(initSelection);
mInviteButton = (Button) findViewById(R.id.invite);
mInviteButton.setText(brandingRes.getString(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT));
mInviteButton.setOnClickListener(mButtonHandler);
mInviteButton.setEnabled(false);
}
示例6: onCreate
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add_new_scheduled_recording);
Button setStartTimeButton = (Button) findViewById(R.id.add_new_scheduled_recording_set_start_time_button);
Button setEndTimeButton = (Button) findViewById(R.id.add_new_scheduled_recording_set_end_time_button);
Button okButton = (Button) findViewById(R.id.add_new_scheduled_recording_ok_button);
Button cancelButton = (Button) findViewById(R.id.add_new_scheduled_recording_cancel_button);
setStartTimeButton.setOnClickListener(this);
setEndTimeButton.setOnClickListener(this);
okButton.setOnClickListener(this);
cancelButton.setOnClickListener(this);
final DatabaseHelper dbHelper = prepareDatabaseHelper();
Spinner favouriteStationSpinner = (Spinner) findViewById(R.id.add_new_scheduled_recording_favourite_station_spinner);
Cursor favouriteStationCursor = dbHelper.getFavourites();
SimpleCursorAdapter favouriteStationAdapter = new SimpleCursorAdapter(this,
R.layout.add_new_scheduled_recording_favourite_stations,
favouriteStationCursor,
new String[]{DatabaseHelper.FAVOURITES_NAME},
new int[]{R.id.name_entry},
CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
favouriteStationAdapter.setDropDownViewResource(R.layout.add_new_scheduled_recording_favourite_stations);
favouriteStationSpinner.setAdapter(favouriteStationAdapter);
Spinner recordingTypeSpinner = (Spinner) findViewById(R.id.add_new_scheduled_recording_recording_type_spinner);
Cursor recordingTypeCursor = dbHelper.getRecordingTypes();
SimpleCursorAdapter recordingTypesAdapter = new SimpleCursorAdapter(this,
R.layout.add_new_scheduled_recording_types,
recordingTypeCursor,
new String[]{DatabaseHelper.RECORDING_TYPES_TYPE},
new int[]{R.id.add_new_scheduled_recording_type_entry},
CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
recordingTypesAdapter.setDropDownViewResource(R.layout.add_new_scheduled_recording_types);
recordingTypeSpinner.setAdapter(recordingTypesAdapter);
Bundle bundle = getIntent().getExtras();
if (bundle != null && bundle.containsKey(getString(R.string.edit_scheduled_recording_id))) {
editMode = true;
scheduledRecordingId = bundle.getLong(getString(R.string.edit_scheduled_recording_id));
DatabaseHelper.ScheduledRecording scheduledRecording = dbHelper.GetScheduledRecording(scheduledRecordingId);
favouriteStationSpinner.setSelection(scheduledRecording.station - 1);
recordingTypeSpinner.setSelection(scheduledRecording.type - 1);
startDateTime = scheduledRecording.startDateTime;
((TextView) findViewById(R.id.add_new_scheduled_recording_start_time_text)).setText(DateUtils.getDateTimeString(startDateTime));
endDateTime = scheduledRecording.endDateTime;
((TextView) findViewById(R.id.add_new_scheduled_recording_end_time_text)).setText(DateUtils.getDateTimeString(endDateTime));
}
dbHelper.close();
}