android.widget.Spinner.getAdapter()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(165)

本文整理了Java中android.widget.Spinner.getAdapter()方法的一些代码示例,展示了Spinner.getAdapter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.getAdapter()方法的具体详情如下:
包路径:android.widget.Spinner
类名称:Spinner
方法名:getAdapter

Spinner.getAdapter介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public static void selectSpinnerItemByValue(Spinner spnr, long value) {
  SimpleCursorAdapter adapter = (SimpleCursorAdapter) spnr.getAdapter();
  for (int position = 0; position < adapter.getCount(); position++) {
    if(adapter.getItemId(position) == value) {
      spnr.setSelection(position);
      return;
    }
  }
}

代码示例来源:origin: stackoverflow.com

public void setSpinText(Spinner spin, String text)
{
  for(int i= 0; i < spin.getAdapter().getCount(); i++)
  {
    if(spin.getAdapter().getItem(i).toString().contains(text))
    {
      spin.setSelection(i);
    }
  }

}

代码示例来源:origin: com.albedinsky.android/ui-widget-input

/**
 * Delegate method for {@link android.widget.Spinner#getAdapter()}.
 */
@Nullable
public SpinnerAdapter getAdapter() {
  return mSpinner != null ? mAdapter = mSpinner.getAdapter() : mAdapter;
}

代码示例来源:origin: stackoverflow.com

public static void selectSpinnerItemByValue(Spinner spnr, long value){
SimpleCursorAdapter adapter = (SimpleCursorAdapter) spnr.getAdapter();
for (int position = 0; position < adapter.getCount(); position++)
{
  if(adapter.getItemId(position) == value)
  {
    spnr.setSelection(position);
    return;
  }
} }

代码示例来源:origin: limboemu/limbo

public void run() {
    if (cpuNum != 0) {
      int pos = ((ArrayAdapter<String>) mCPUNum.getAdapter()).getPosition(cpuNum + "");
      mCPUNum.setSelection(pos);
    }
  }
});

代码示例来源:origin: limboemu/limbo

public void run() {
    if (value != null) {
      int pos = ((ArrayAdapter<String>) spinner.getAdapter()).getPosition(value);
      spinner.setSelection(pos);
    }
  }
});

代码示例来源:origin: mobnetic/BitcoinChecker

private String getSelectedCurrencyCounter() {
  if(currencyCounterSpinner.getAdapter()==null)
    return null;
  return String.valueOf(currencyCounterSpinner.getSelectedItem());
}

代码示例来源:origin: limboemu/limbo

public void run() {
    if (((ArrayAdapter<String>) mSD.getAdapter()).getPosition(file) < 0) {
      ((ArrayAdapter<String>) mSD.getAdapter()).add(file);
    }
    setDiskValue(mSD, file);
    int res = mSD.getSelectedItemPosition();
    if (res == 1) {
      mSD.setSelection(0);
    }
  }
});

代码示例来源:origin: limboemu/limbo

public void run() {
    if (((ArrayAdapter<String>) mCD.getAdapter()).getPosition(file) < 0) {
      ((ArrayAdapter<String>) mCD.getAdapter()).add(file);
    }
    setDiskValue(mCD, file);
    int res = mCD.getSelectedItemPosition();
    if (res == 1) {
      mCD.setSelection(0);
    }
  }
});

代码示例来源:origin: limboemu/limbo

public void run() {
    if (((ArrayAdapter<String>) mFDA.getAdapter()).getPosition(file) < 0) {
      ((ArrayAdapter<String>) mFDA.getAdapter()).add(file);
    }
    setDiskValue(mFDA, file);
    int res = mFDA.getSelectedItemPosition();
    if (res == 1) {
      mFDA.setSelection(0);
    }
  }
});

代码示例来源:origin: limboemu/limbo

public void run() {
    if (((ArrayAdapter<String>) mFDB.getAdapter()).getPosition(file) < 0) {
      ((ArrayAdapter<String>) mFDB.getAdapter()).add(file);
    }
    setDiskValue(mFDB, file);
    int res = mFDB.getSelectedItemPosition();
    if (res == 1) {
      mFDB.setSelection(0);
    }
  }
});

代码示例来源:origin: stackoverflow.com

public static void selectSpinnerItemByValue(Spinner spnr, long value) {
  SpinnerAdapter adapter = spnr.getAdapter();
  for (int position = 0; position < adapter.getCount(); position++) {
    if(adapter.getItemId(position) == value) {
      spnr.setSelection(position);
      return;
    }
  }
}

代码示例来源:origin: limboemu/limbo

public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
  String orientationCfg = (String) ((ArrayAdapter<?>) mOrientation.getAdapter()).getItem(position);
  LimboSettingsManager.setOrientationSetting(activity, position);
  updateSummary(false);
}

代码示例来源:origin: limboemu/limbo

public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
  if(currMachine == null)
    return;
  String ram = (String) ((ArrayAdapter<?>) mRamSize.getAdapter()).getItem(position);
    currMachine.memory = Integer.parseInt(ram);
    MachineOpenHelper.getInstance(activity).update(currMachine, MachineOpenHelper.MEMORY,
        ram);
  updateSummary(false);
}

代码示例来源:origin: limboemu/limbo

public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
  if(currMachine == null)
    return;
  String mouseCfg = (String) ((ArrayAdapter<?>) mMouse.getAdapter()).getItem(position);
  String mouseDB = mouseCfg.split(" ")[0];
  currMachine.mouse = mouseDB;
  MachineOpenHelper.getInstance(activity).update(currMachine, MachineOpenHelper.MOUSE, mouseDB);
  updateSummary(false);
}

代码示例来源:origin: limboemu/limbo

public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
  if(currMachine == null)
    return;
  String cpu = (String) ((ArrayAdapter<?>) mCPU.getAdapter()).getItem(position);
  currMachine.cpu = cpu;
  MachineOpenHelper.getInstance(activity).update(currMachine, MachineOpenHelper.CPU, cpu);
  updateSummary(false);
}

代码示例来源:origin: limboemu/limbo

public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
  if(currMachine == null)
    return;
  String bootDev = (String) ((ArrayAdapter<?>) mBootDevices.getAdapter()).getItem(position);
  MachineOpenHelper.getInstance(activity).update(currMachine, MachineOpenHelper.BOOT_CONFIG,
      bootDev);
  currMachine.bootdevice = bootDev;
  updateSummary(false);
}

代码示例来源:origin: limboemu/limbo

public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
  if(currMachine == null)
    return;
  String vgacfg = (String) ((ArrayAdapter<?>) mVGAConfig.getAdapter()).getItem(position);
  MachineOpenHelper.getInstance(activity).update(currMachine, MachineOpenHelper.VGA,
      vgacfg);
  currMachine.vga_type = vgacfg;
  updateSummary(false);
}

代码示例来源:origin: limboemu/limbo

public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
  if(currMachine == null)
    return;
  String sndcfg = (String) ((ArrayAdapter<?>) mSoundCard.getAdapter()).getItem(position);
  MachineOpenHelper.getInstance(activity).update(currMachine,
      MachineOpenHelper.SOUNDCARD_CONFIG, sndcfg);
  currMachine.soundcard = sndcfg;
  updateSummary(false);
}

代码示例来源:origin: limboemu/limbo

public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
  if(currMachine == null)
    return;
  String keyboardCfg = (String) ((ArrayAdapter<?>) mKeyboard.getAdapter()).getItem(position);
  currMachine.keyboard = keyboardCfg;
  MachineOpenHelper.getInstance(activity).update(currMachine, MachineOpenHelper.KEYBOARD, keyboardCfg);
  updateSummary(false);
}

相关文章