本文整理了Java中android.widget.Spinner.getCount()
方法的一些代码示例,展示了Spinner.getCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.getCount()
方法的具体详情如下:
包路径:android.widget.Spinner
类名称:Spinner
方法名:getCount
暂无
代码示例来源:origin: novoda/android-demos
int getCount() {
return mView.getCount();
}
代码示例来源:origin: stackoverflow.com
mySpinner.setSelection(getIndex(mySpinner, myValue));
//private method of your class
private int getIndex(Spinner spinner, String myString)
{
int index = 0;
for (int i=0;i<spinner.getCount();i++){
if (spinner.getItemAtPosition(i).toString().equalsIgnoreCase(myString)){
index = i;
break;
}
}
return index;
}
代码示例来源:origin: k9mail/k-9
public static void setSpinnerOptionValue(Spinner spinner, Object value) {
for (int i = 0, count = spinner.getCount(); i < count; i++) {
SpinnerOption so = (SpinnerOption)spinner.getItemAtPosition(i);
if (so.value.equals(value)) {
spinner.setSelection(i, true);
return;
}
}
}
代码示例来源:origin: stackoverflow.com
private int getIndex(Spinner spinner, String myString){
int index = 0;
for (int i=0;i<spinner.getCount();i++){
if (spinner.getItemAtPosition(i).equals(myString)){
index = i;
}
}
return index;
}
代码示例来源:origin: ankidroid/Anki-Android
private int getSpinnerIndex(Spinner spinner, String myString){
int index = 0;
for (int i=0;i<spinner.getCount();i++){
if (spinner.getItemAtPosition(i).equals(myString)){
index = i;
}
}
return index;
}
}
代码示例来源:origin: daniulive/SmarterStreaming
swVideoEncoderSpeedSelector.setSelection(swVideoEncoderSpeedSelector.getCount() - sw_video_encoder_speed,true);
代码示例来源:origin: facebook/facebook-android-sdk
if (spinner.getCount() > 0) {
Object selectedItem = ((Spinner) view).getSelectedItem();
if (selectedItem != null) {
代码示例来源:origin: chat-sdk/chat-sdk-android
protected int getIndex(Spinner spinner, String myString) {
int index = 0;
for (int i = 0; i<spinner.getCount(); i++) {
if (spinner.getItemAtPosition(i).toString().equalsIgnoreCase(myString)) {
index = i;
break;
}
}
return index;
}
代码示例来源:origin: stackoverflow.com
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setAdapter(new SimpleCursorAdapter(...));
for (int i = 0; i < spinner.getCount(); i++) {
Cursor value = (Cursor) spinner.getItemAtPosition(i);
long id = value.getLong(value.getColumnIndex("_id"));
if (id == rowid) {
spinner.setSelection(i);
}
}
代码示例来源:origin: stackoverflow.com
private void selectSpinnerValue(Spinner spinner, String myString)
{
int index = 0;
for(int i = 0; i < spinner.getCount(); i++){
if(spinner.getItemAtPosition(i).toString().equals(myString)){
spinner.setSelection(i);
break;
}
}
}
代码示例来源:origin: stackoverflow.com
private void selectValue(Spinner spinner, Object value) {
for (int i = 0; i < spinner.getCount(); i++) {
if (spinner.getItemAtPosition(i).equals(value)) {
spinner.setSelection(i);
break;
}
}
}
代码示例来源:origin: stackoverflow.com
private void selectSpinnerValue(Spinner spinner, String myString)
{
int index = 0;
for(int i = 0; i < spinner.getCount(); i++){
if(spinner.getItemAtPosition(i).toString().equals(myString)){
spinner.setSelection(i);
break;
}
}
}
代码示例来源:origin: LonamiWebs/Stringlate
private int getItemIndex(Spinner spinner, String str) {
if (str == null || str.isEmpty())
return -1;
for (int i = 0; i < spinner.getCount(); i++)
if (spinner.getItemAtPosition(i).toString().equalsIgnoreCase(str))
return i;
return -1;
}
代码示例来源:origin: dimtion/Shaarlier
private void initAccountSpinner() {
final Spinner accountSpinnerView = (Spinner) a_dialogView.findViewById(R.id.chooseAccount);
ArrayAdapter adapter = new ArrayAdapter<>(this, R.layout.tags_list, this.allAccounts);
accountSpinnerView.setAdapter(adapter);
if (accountSpinnerView.getCount() <= 1) {
accountSpinnerView.setVisibility(View.GONE);
}
}
代码示例来源:origin: brarcher/video-transcoder
private void setSpinnerSelection(Spinner spinner, Object value)
{
for(int index = 0; index < spinner.getCount(); index++)
{
String item = spinner.getItemAtPosition(index).toString();
if(item.equals(value.toString()))
{
spinner.setSelection(index);
break;
}
}
}
代码示例来源:origin: LonamiWebs/Stringlate
@Override
public void onClick(DialogInterface dialogInterface, int i) {
mRepo.deleteLocale(mSelectedLocale);
loadLocalesSpinner();
checkTranslationVisibility();
// We need to clear the selected locale if it's now empty
if (mLocaleSpinner.getCount() == 0)
setCurrentLocale(null);
}
})
代码示例来源:origin: stackoverflow.com
private int getIndexByString(Spinner spinner, String string) {
int index = 0;
for (int i = 0; i < spinner.getCount(); i++) {
if (spinner.getItemAtPosition(i).toString().equalsIgnoreCase(string)) {
index = i;
break;
}
}
return index;
}
代码示例来源:origin: stackoverflow.com
public int getPosition(Spinner your_spinner, String string_value){
int position = 0;
for (int i=0;i<your_spinner.getCount();i++){
if (your_spinner.getItemAtPosition(i).equals(string_value)){
position = i;
}
}
return position;
}
代码示例来源:origin: stackoverflow.com
TextView mTextView2 = (TextView) v
.findViewById(R.id.payer_payee_default_category);
Spinner mSpinner = (Spinner) findViewById(R.id.categories_spinner);
CursorWrapper mCursorWrapper;
for (int nbr = 0; nbr < mSpinner.getCount(); nbr++) {
mCursorWrapper = (CursorWrapper) mSpinner.getItemAtPosition(nbr);
if (String.valueOf(mCursorWrapper.getString(1)).equals(
String.valueOf(mTextView2.getText()))) {
mSpinner.setSelection(nbr);
}
}
代码示例来源:origin: LonamiWebs/Stringlate
private void deleteCurrentLocale() {
mRepo.deleteLocale(mSelectedLocale);
loadLocalesSpinner();
checkTranslationVisibility();
// We need to clear the selected locale if it's now empty
if (mLocaleSpinner.getCount() == 0)
setCurrentLocale(null);
}
内容来源于网络,如有侵权,请联系作者删除!