当前位置: 首页>>代码示例>>Java>>正文


Java Spinner.setSelection方法代码示例

本文整理汇总了Java中android.widget.Spinner.setSelection方法的典型用法代码示例。如果您正苦于以下问题:Java Spinner.setSelection方法的具体用法?Java Spinner.setSelection怎么用?Java Spinner.setSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Spinner的用法示例。

在下文中一共展示了Spinner.setSelection方法的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onResume

import android.widget.Spinner; //导入方法依赖的package包/类
/**
 * Method allows us to retrieve previous selection before the activity was paused
 */
@Override
protected void onResume() {
    super.onResume();

    try {

        /*
         * Retrieve the saved spinner selection
         */
        spinner = (Spinner) findViewById(R.id.setPin_spinner);
        SharedPreferences category_prefs = getSharedPreferences("category_prefs", Context.MODE_PRIVATE);
        int spinner_index = category_prefs.getInt("spinner_indx", 0);
        spinner.setSelection(spinner_index);

    } catch (Exception ex) {

        Log.e("Spinner onResume", ex.getMessage(), ex);
    }

}
 
开发者ID:eyeRS,项目名称:eyeRS,代码行数:24,代码来源:SetPINActivity.java


示例2: loadCommandSpinner

import android.widget.Spinner; //导入方法依赖的package包/类
private void loadCommandSpinner(Spinner spinner, Command command) {
	AlertTypeItemSelectedListener listener = new AlertTypeItemSelectedListener(command);
	spinner.setOnItemSelectedListener(listener);
	List<String> list = new ArrayList<String>();
	int defaultPos = 0;
	int pos = 0;
	for (String callableCommand : callableCommandNames) {
		int resourceId = getResources().getIdentifier(callableCommand, "string", getPackageName());
		if (resourceId != 0) {
			list.add(getString(resourceId));
		}
		else {
			list.add(callableCommand);
		}
		if (callableCommand.equals(command.getMethod())) {
			defaultPos = pos;
		}
		pos++;
	}
	ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);
	dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spinner.setAdapter(dataAdapter);
	spinner.setSelection(defaultPos);
}
 
开发者ID:masterjc,项目名称:bluewatcher,代码行数:25,代码来源:ControlModeEditorActivity.java


示例3: fillTrackInstrument

import android.widget.Spinner; //导入方法依赖的package包/类
public void fillTrackInstrument() {
	ArrayAdapter<TGSelectableItem> adapter = new ArrayAdapter<TGSelectableItem>(getActivity(), android.R.layout.simple_spinner_item, createSelectableChannels());
	
	Spinner spinner = (Spinner) this.dialogView.findViewById(R.id.track_channel_dlg_channel_value);
	spinner.setAdapter(adapter);
	spinner.setSelection(adapter.getPosition(new TGSelectableItem(this.songManager.getChannel(this.song, this.track.getChannelId()), null)));
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:8,代码来源:TGTrackChannelDialog.java


示例4: selectSpinnerItemByValue

import android.widget.Spinner; //导入方法依赖的package包/类
/**
 *
 * @param spnr
 * @param value
 *
 * solution based on an answer from stack overflow
 * resource: https://stackoverflow.com/questions/11072576/set-selected-item-of-spinner-programmatically
 *
 */

public static void selectSpinnerItemByValue(Spinner spnr, String value) {
    ArrayAdapter<String> adapter = (ArrayAdapter<String>) spnr.getAdapter();
    String currentItem;

    for (int i = 0; i < adapter.getCount(); i++) {
        currentItem = adapter.getItem(i);
        if(currentItem.equals(value)) {
            spnr.setSelection(i);
            return;
        }
    }
}
 
开发者ID:CMPUT301F17T15,项目名称:CIA,代码行数:23,代码来源:HabitViewActivity.java


示例5: setControls

import android.widget.Spinner; //导入方法依赖的package包/类
private void setControls() {
    iconNumber = (Spinner) findViewById(R.id.stIconNumber);

    List<String> spinnerArray = new ArrayList<>();
    spinnerArray.add(String.valueOf(Const.ICONS_SIZE.ICONS_BIG));
    spinnerArray.add(String.valueOf(Const.ICONS_SIZE.ICONS_MEDIUM));
    spinnerArray.add(String.valueOf(Const.ICONS_SIZE.ICONS_LOW));
    spinnerArray.add(String.valueOf(Const.ICONS_SIZE.ICONS_LOWER));
    spinnerArray.add(String.valueOf(Const.ICONS_SIZE.ICONS_LOWEST));
    spinnerArray.add(String.valueOf(Const.ICONS_SIZE.ICONS_LOWESTER));
    spinnerArray.add(String.valueOf(Const.ICONS_SIZE.ICONS_LOWESTEREST));

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            R.layout.spinner_item, spinnerArray);

    iconNumber.setAdapter(adapter);
    iconNumber.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);

    iconNumber.setSelection(selectedPosition, true);

    btnChooseWallpaper = (Button) findViewById(R.id.stWallpaperButton);
    btnChooseWallpaper.setOnClickListener(this);
    btnWallpaperDefault = (Button) findViewById(R.id.stWallpaperButtonDefault);
    btnWallpaperDefault.setOnClickListener(this);
    txtCustomTitle = (EditText) findViewById(R.id.stCustomTitleValue);
}
 
开发者ID:ZetsPsych,项目名称:kibou-game-library,代码行数:27,代码来源:SettingsActivity.java


示例6: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setContentView(R.layout.act_colors);

	mColorScheme = HostDatabase.DEFAULT_COLOR_SCHEME;

	mHostDb = HostDatabase.get(this);

	mColorList = mHostDb.getColorsForScheme(mColorScheme);
	mDefaultColors = mHostDb.getDefaultColorsForScheme(mColorScheme);

	mColorGrid = (GridView) findViewById(R.id.color_grid);
	mColorGrid.setAdapter(new ColorsAdapter(true));
	mColorGrid.setOnItemClickListener(this);
	mColorGrid.setSelection(0);

	mFgSpinner = (Spinner) findViewById(R.id.fg);
	mFgSpinner.setAdapter(new ColorsAdapter(false, R.string.colors_fg_label));
	mFgSpinner.setSelection(mDefaultColors[0]);
	mFgSpinner.setOnItemSelectedListener(this);

	mBgSpinner = (Spinner) findViewById(R.id.bg);
	mBgSpinner.setAdapter(new ColorsAdapter(false, R.string.color_bg_label));
	mBgSpinner.setSelection(mDefaultColors[1]);
	mBgSpinner.setOnItemSelectedListener(this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:ColorsActivity.java


示例7: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    TextView versionInfoTextView = (TextView) findViewById(R.id.VersionInfoTextView);
    String info = "版本号:" + getVersionDescription() + ",编译时间:" + getBuildTimeDescription();
    versionInfoTextView.setText(info);

    mPreviewSizeRatioSpinner = (Spinner) findViewById(R.id.PreviewSizeRatioSpinner);
    mPreviewSizeLevelSpinner = (Spinner) findViewById(R.id.PreviewSizeLevelSpinner);
    mEncodingModeLevelSpinner = (Spinner) findViewById(R.id.EncodingModeLevelSpinner);
    mEncodingSizeLevelSpinner = (Spinner) findViewById(R.id.EncodingSizeLevelSpinner);
    mEncodingBitrateLevelSpinner = (Spinner) findViewById(R.id.EncodingBitrateLevelSpinner);

    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.PREVIEW_SIZE_RATIO_TIPS_ARRAY);
    mPreviewSizeRatioSpinner.setAdapter(adapter);

    adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.PREVIEW_SIZE_LEVEL_TIPS_ARRAY);
    mPreviewSizeLevelSpinner.setAdapter(adapter);
    mPreviewSizeLevelSpinner.setSelection(3);

    adapter= new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.ENCODING_MODE_LEVEL_TIPS_ARRAY);
    mEncodingModeLevelSpinner.setAdapter(adapter);
    mEncodingModeLevelSpinner.setSelection(0);

    adapter= new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.ENCODING_SIZE_LEVEL_TIPS_ARRAY);
    mEncodingSizeLevelSpinner.setAdapter(adapter);
    mEncodingSizeLevelSpinner.setSelection(7);

    adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.ENCODING_BITRATE_LEVEL_TIPS_ARRAY);
    mEncodingBitrateLevelSpinner.setAdapter(adapter);
    mEncodingBitrateLevelSpinner.setSelection(2);
}
 
开发者ID:pili-engineering,项目名称:PLDroidShortVideo,代码行数:35,代码来源:MainActivity.java


示例8: onViewCreated

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
	super.onViewCreated(view, savedInstanceState);
	final Spinner spinnerTimer = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_timer);
	final Spinner spinnerWhen = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_when);
	final Spinner spinnerColors = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_colors);
	final SpinnerLayout spinnerLayoutTimer = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_timer);
	final SpinnerLayout sSpinnerLayoutWhen = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_when);
	final SpinnerLayout spinnerLayoutColors = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_colors);
	final SpinnerLayout spinnerLayoutColorsDisabled = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_colors_disabled);

	final Context context = getActivity();
	spinnerTimer.setAdapter(new TimerAdapter(context));
	spinnerTimer.setSelection(2, false);
	spinnerTimer.setOnItemSelectedListener(this);

	spinnerWhen.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, WHEN));
	spinnerWhen.setSelection(0, false);
	spinnerWhen.setOnItemSelectedListener(this);

	spinnerColors.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS));
	spinnerColors.setSelection(0, false);
	spinnerColors.setOnItemSelectedListener(this);

	spinnerLayoutTimer.setAdapter(new TimerAdapter(context));
	spinnerLayoutTimer.setSelection(2, false);
	spinnerLayoutTimer.setOnItemSelectedListener(this);

	sSpinnerLayoutWhen.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, WHEN));
	sSpinnerLayoutWhen.setOnItemSelectedListener(this);

	spinnerLayoutColors.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS));
	spinnerLayoutColors.setOnItemSelectedListener(this);

	spinnerLayoutColorsDisabled.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS));
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:37,代码来源:MenusFragment.java


示例9: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_edit_issue);
    mIssuename = (EditText) findViewById(R.id.IssueName);
    mIssueDesc = (EditText) findViewById(R.id.descriptionTex);
    mPosesrisk = (RadioGroup) findViewById(R.id.risk);
    mImageView = (ImageView) findViewById(R.id.eventView);
    mRisk = false;
    mIssueAdapter = AdapterFactory.getInstance().getIssueAdapter(this);
    Spinner categorySpinner = (Spinner) findViewById(R.id.nameCategorySpinner);
    categorySpinner.setAdapter(new CategorySpinnerAdapter(getApplicationContext(),
            R.layout.text_and_icon_spinner_tem));
    categorySpinner.setSelection(categorySpinner.getCount());
    Intent intent = getIntent();
    Bundle data = intent.getBundleExtra(TAG_ISSUE);
    mIssue = (Issue) data.getSerializable(TAG_ISSUE);
    mIssuename.setText(mIssue.getTitle());
    mIssueDesc.setText(mIssue.getDescription());
    String url = mIssue.getPicture().getMedUrl();
    Glide.with(this).load(url).into(mImageView);
    Category[] categories = Category.values();
    for (int i = 0; i < categories.length; ++i) {
        if (mIssue.getCategory().equals(categories[i])) {
            categorySpinner.setSelection(i);
        }
    }
    if (mIssue.isRisk()) {
        mPosesrisk.check(R.id.yes);
        mRisk = true;
    } else mPosesrisk.check(R.id.no);
    Toolbar toolbar = (Toolbar) findViewById(R.id.create_issue_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle(getString(R.string.edit_issue));
    mPosesrisk.setOnCheckedChangeListener(mRadioListener);
    mPictureUpdated = false;
    setupCloseKeyboard(findViewById(android.R.id.content));
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:41,代码来源:EditIssueActivity.java


示例10: initOutlineSizeSpinner

import android.widget.Spinner; //导入方法依赖的package包/类
private void initOutlineSizeSpinner(float outlineSize) {
    Spinner spinner = (Spinner) findViewById(R.id.edit_outline_size);
    spinner.setOnItemSelectedListener(this);
    String[] sizeList = new String[]{"Thin", "Normal", "Thick"};
    spinner.setAdapter(new ArrayAdapter<>(this,
            android.R.layout.simple_spinner_dropdown_item, sizeList));
    spinner.setSelection(outlineSizeToPosition(outlineSize));
}
 
开发者ID:olgamiller,项目名称:SSTVEncoder2,代码行数:9,代码来源:EditTextActivity.java


示例11: fillData

import android.widget.Spinner; //导入方法依赖的package包/类
public void fillData(View view, int type, int selection) {
	TGSelectableItem[] selectableItems = createDataValues(type);
	ArrayAdapter<TGSelectableItem> adapter = new ArrayAdapter<TGSelectableItem>(getActivity(), android.R.layout.simple_spinner_item, selectableItems);
	
	Spinner spinner = (Spinner) view.findViewById(R.id.harmonic_dlg_data_value);
	spinner.setAdapter(adapter);
	spinner.setEnabled(selectableItems.length > 0);
	spinner.setVisibility(selectableItems.length > 0 ? View.VISIBLE : View.GONE);
	if( selectableItems.length > 0 ) {
		spinner.setSelection(adapter.getPosition(new TGSelectableItem(Integer.valueOf(selection), null)));
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:13,代码来源:TGHarmonicDialog.java


示例12: fillCount

import android.widget.Spinner; //导入方法依赖的package包/类
public void fillCount(View view) {
	ArrayAdapter<TGSelectableItem> adapter = new ArrayAdapter<TGSelectableItem>(getActivity(), android.R.layout.simple_spinner_item, createCountValues());
	
	Spinner spinner = (Spinner) view.findViewById(R.id.measure_add_dlg_count_value);
	spinner.setAdapter(adapter);
	spinner.setSelection(adapter.getPosition(new TGSelectableItem(Integer.valueOf(1), null)));
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:8,代码来源:TGMeasureAddDialog.java


示例13: onCreateOptionsMenu

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.menu_salaries, menu);
    Spinner spinner = (Spinner) MenuItemCompat.getActionView(menu.findItem(R.id.action_category));
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(),
            R.array.array_period_date, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setSelection(periodIndex);//set prevision selected period
    spinner.setOnItemSelectedListener(onItemSelectedListener);
}
 
开发者ID:graviton57,项目名称:DOUSalaries,代码行数:13,代码来源:SalaryWidgetFragment.java


示例14: setupDOBSpinners

import android.widget.Spinner; //导入方法依赖的package包/类
private void setupDOBSpinners () {
    dobDaySpinner = (Spinner) findViewById(R.id.dob_day_spinner);
    dobMonthSpinner = (Spinner) findViewById(R.id.dob_month_spinner);
    dobYearSpinner = (Spinner) findViewById(R.id.dob_year_spinner);

    List<String> days = new ArrayList<>();
    for (int i = 0; i < 31; i++) {
        days.add("" + (i + 1));
    }
    ArrayAdapter<String> dayAdapter = new ArrayAdapter<>(this,
            android.R.layout.simple_spinner_item, days);
    dayAdapter.setDropDownViewResource(R.layout.spinner_dropdown);
    dobDaySpinner.setAdapter(dayAdapter);

    ArrayAdapter<CharSequence> monthAdapter = ArrayAdapter.createFromResource(this,
            R.array.months_array, android.R.layout.simple_spinner_item);
    monthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    dobMonthSpinner.setAdapter(monthAdapter);

    Date dt = new Date();
    List<String> years = new ArrayList<>();
    int maxYear = dt.getYear() + 1900 - 18;
    for (int i = 1900; i <= maxYear; i++) {
        years.add("" + i);
    }
    ArrayAdapter<String> yearAdapter = new ArrayAdapter<>(this,
            android.R.layout.simple_spinner_item, years);
    yearAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    dobYearSpinner.setAdapter(yearAdapter);
    dobYearSpinner.setSelection(DOB_YEAR_STARTING_INDEX);
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:32,代码来源:ManualInputActivity.java


示例15: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    if (!(Thread.getDefaultUncaughtExceptionHandler() instanceof CustomExceptionHandler))
        Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler());

    Logger.info("Hello World");

    settings = new Settings();
    fps = 24;

    bnStart = (Button) findViewById(R.id.bnStart);
    bnStart.setOnClickListener(bnStartOnClickListener);

    bnClose = (Button) findViewById(R.id.bnClose);
    bnClose.setOnClickListener(bnCloseOnClickListener);

    tabHost = (TabHost)findViewById(R.id.tabHost);
    tabHost.setup();

    //Tab 1
    TabHost.TabSpec spec = tabHost.newTabSpec("Tab One");
    spec.setContent(R.id.tab1);
    spec.setIndicator("");
    tabHost.addTab(spec);

    //Tab 2
    spec = tabHost.newTabSpec("Tab Two");
    spec.setContent(R.id.tab2);
    spec.setIndicator("");
    tabHost.addTab(spec);

    tvIntervalValue = (TextView) findViewById(R.id.tvIntervalValue);
    tvIntervalUnit = (TextView) findViewById(R.id.tvIntervalUnit);

    sbInterval = (AdvancedSeekBar) findViewById(R.id.sbInterval);
    sbInterval.setMax(83);
    sbInterval.setOnSeekBarChangeListener(sbIntervalOnSeekBarChangeListener);

    tvShotsValue = (TextView) findViewById(R.id.tvShotsValue);

    sbShots = (AdvancedSeekBar) findViewById(R.id.sbShots);
    sbShots.setMax(130);
    sbShots.setOnSeekBarChangeListener(sbShotsOnSeekBarChangeListener);

    tvDurationValue = (TextView) findViewById(R.id.tvDurationValue);
    tvDurationUnit = (TextView) findViewById(R.id.tvDurationUnit);
    tvVideoTimeValue = (TextView) findViewById(R.id.tvVideoTimeValue);
    tvVideoTimeUnit = (TextView) findViewById(R.id.tvVideoTimeUnit);

    spnFps = (Spinner) findViewById(R.id.spnFps);
    spnFps.setSelection(0);
    spnFps.setOnItemSelectedListener(spnFpsOnItemSelectedListener);

    cbSilentShutter = (CheckBox) findViewById(R.id.cbSilentShutter);
    cbSilentShutter.setOnCheckedChangeListener(cbSilentShutterOnCheckListener);
}
 
开发者ID:jonasjuffinger,项目名称:TimeLapse,代码行数:61,代码来源:SettingsActivity.java


示例16: onOptionsItemSelected

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case Menu.FIRST:
		EditText edtIntegExpr = (EditText) findViewById(R.id.integrated_expr_edit);
		edtIntegExpr.setText("sin(x)*y");
		
		EditText edtXName = (EditText) findViewById(R.id.x_variable_name_edit);
		edtXName.setText("x");
		EditText edtXFrom = (EditText) findViewById(R.id.x_variable_from_edit);
		edtXFrom.setText("3 + 4*i");
		EditText edtXTo = (EditText) findViewById(R.id.x_variable_to_edit);
		edtXTo.setText("13 - 32.33*i");
		EditText edtXNumberOfSteps = (EditText) findViewById(R.id.x_variable_number_of_steps_edit);
		edtXNumberOfSteps.setText("20");
		
		EditText edtYName = (EditText) findViewById(R.id.y_variable_name_edit);
		edtYName.setText("y");
		EditText edtYFrom = (EditText) findViewById(R.id.y_variable_from_edit);
		edtYFrom.setText("18");
		EditText edtYTo = (EditText) findViewById(R.id.y_variable_to_edit);
		edtYTo.setText("64");
		EditText edtYNumberOfSteps = (EditText) findViewById(R.id.y_variable_number_of_steps_edit);
		edtYNumberOfSteps.setText("15");
		
        Spinner spinnerMultipleIntegral = (Spinner) findViewById(R.id.multiple_integral_spinner);
        spinnerMultipleIntegral.setSelection(SELECT_2ND_LEVEL_INTEGRAL);	// level 2 integration
        break;
	case Menu.FIRST + 1:
	   	if (mnSoftKeyState == ENABLE_SHOW_SOFTKEY)	{
            // code to hide the soft keyboard
            setSoftKeyState(minputMethod.medtInput, ENABLE_HIDE_INPUTPAD);
	   	} else	{
	   		// code to enable the soft keyboard
	   		setSoftKeyState(minputMethod.medtInput, ENABLE_SHOW_SOFTKEY);
	   	}
		break;
	case Menu.FIRST + 2:
	   	Intent intentHelp = new Intent(this, ActivityShowHelp.class);
	   	Bundle bundle = new Bundle();
	   	bundle.putString("HELP_CONTENT", "integration");
	   	//Add this bundle to the intent
	   	intentHelp.putExtras(bundle);
	   	startActivity(intentHelp);
		break;
	}
	return super.onOptionsItemSelected(item);
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:49,代码来源:ActivityIntegrate.java


示例17: fillInData

import android.widget.Spinner; //导入方法依赖的package包/类
private void fillInData(SharedPreferences prefs) {
    //Edittext's connected to the fields in the student profile.
    EditText fullName = (EditText) findViewById(R.id.studentNameSettings);
    EditText email = (EditText) findViewById(R.id.studentEmailSettings);
    EditText major = (EditText) findViewById(R.id.studentMajorSettings);
    EditText city = (EditText) findViewById(R.id.studentCitySettings);
    EditText gradYear = (EditText) findViewById(R.id.studentGradYearSettings);
    EditText un = (EditText) findViewById(R.id.studentUsernameSettings);
    EditText pw = (EditText) findViewById(R.id.studentPasswordSettings);

    //Spinners for displaying states, and terms of graduation.
    Spinner stateSpinner = (Spinner) findViewById(R.id.stateSpinnerSettings);
    Spinner gradTermSpinner = (Spinner) findViewById(R.id.FallSpringSpinnerSettings);
    ArrayAdapter stateAdapter = (ArrayAdapter) stateSpinner.getAdapter();
    ArrayAdapter gradTermAdapter = (ArrayAdapter) gradTermSpinner.getAdapter();
    int statePos = stateAdapter.getPosition(prefs.getString("state","") );
    int gradPos = gradTermAdapter.getPosition(prefs.getString("gradTerm","") );

    //Getting data from the shared preferences to populate the student profile fields.
    fullName.setText(prefs.getString("fullName", ""));
    email.setText(prefs.getString("email",""));
    major.setText(prefs.getString("major",""));
    city.setText(prefs.getString("city",""));
    gradYear.setText(prefs.getString("gradYear",""));
    un.setText(prefs.getString("username",""));
    pw.setText(prefs.getString("password",""));
    stateSpinner.setSelection(statePos);
    gradTermSpinner.setSelection(gradPos);

    //Create new profile pic object.
    pic = new ProfilePic(null);
    ImageView profilePic = (ImageView) findViewById(R.id.thumbnailSettings);
    String imgString = prefs.getString("profilePic", "");
    //If the image string is blank, set the profile pic in the layout to the default
    //camera drawable image.
    if(imgString == "")
        profilePic.setImageDrawable(getResources().getDrawable(R.drawable.ic_menu_camera));
    //Otherwise, decode the image string, and use that bitmap for the profile pic.
    else {
        pic.setBitmap(pic.getDecodedBitmap(imgString));
        profilePic.setImageBitmap(pic.getResizedBitmap());
    }
}
 
开发者ID:umdcs,项目名称:linkedout_procon,代码行数:44,代码来源:StudentModSettings.java


示例18: onCreate

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rtc_streaming_config);

    setTitle(R.string.rtc_rtmp);

    mCaptureRadioGroup = (RadioGroup) findViewById(R.id.CaptureRadioGroup);
    mCodecRadioGroup = (RadioGroup) findViewById(R.id.CodecRadioGroup);
    mRTCModeRadioGroup = (RadioGroup) findViewById(R.id.RTCModeGroup);
    mBitrateControlRadioGroup = (RadioGroup) findViewById(R.id.bitrate_control_group);

    mCheckBoxBeauty = (CheckBox) findViewById(R.id.CheckboxBeauty);
    mCheckBoxWatermark = (CheckBox) findViewById(R.id.CheckboxWatermark);
    mCheckBoxDebugMode = (CheckBox) findViewById(R.id.CheckboxDebugMode);
    mCheckBoxCustomSetting = (CheckBox) findViewById(R.id.CheckboxCustomSetting);
    mCheckBoxAudioLevel = (CheckBox) findViewById(R.id.CheckboxAudioLevel);
    mCheckboxEnableStats = (CheckBox) findViewById(R.id.CheckboxEnableStats);

    mPreviewSizeRatioSpinner = (Spinner) findViewById(R.id.PreviewSizeRatioSpinner);
    mPreviewSizeLevelSpinner = (Spinner) findViewById(R.id.PreviewSizeLevelSpinner);
    mEncodingSizeRatioSpinner = (Spinner) findViewById(R.id.EncodingSizeRatioSpinner);
    mEncodingSizeLevelSpinner = (Spinner) findViewById(R.id.EncodingSizeLevelSpinner);
    mEncodingConfigSpinner = (Spinner) findViewById(R.id.EncodingConfig);

    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, StreamingSettings.PREVIEW_SIZE_RATIO_TIPS_ARRAY);
    mPreviewSizeRatioSpinner.setAdapter(adapter);
    mPreviewSizeRatioSpinner.setSelection(1);

    adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, StreamingSettings.PREVIEW_SIZE_LEVEL_TIPS_ARRAY);
    mPreviewSizeLevelSpinner.setAdapter(adapter);
    mPreviewSizeLevelSpinner.setSelection(1);

    adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, StreamingSettings.ENCODING_SIZE_RATIO_TIPS_ARRAY);
    mEncodingSizeRatioSpinner.setAdapter(adapter);
    mEncodingSizeRatioSpinner.setSelection(1);

    adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, StreamingSettings.ENCODING_SIZE_LEVEL_TIPS_ARRAY);
    mEncodingSizeLevelSpinner.setAdapter(adapter);
    mEncodingSizeLevelSpinner.setSelection(1);

    adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, StreamingSettings.ENCODING_TIPS_ARRAY);
    mEncodingConfigSpinner.setAdapter(adapter);
    mEncodingConfigSpinner.setSelection(0);

    mRoomEditText = (EditText) findViewById(R.id.RoomNameEditView);
    SharedPreferences preferences = getSharedPreferences(getString(R.string.app_name), Context.MODE_PRIVATE);
    mRoomEditText.setText(preferences.getString("roomName", ""));

    MultiDex.install(this);
    try {
        PLNetworkManager.getInstance().startDnsCacheService(this);
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    mProgressDialog = new ProgressDialog(this);
}
 
开发者ID:pili-engineering,项目名称:PLDroidRTCStreaming,代码行数:59,代码来源:RTCStreamingEntryActivity.java


示例19: updateSpinnerSelection

import android.widget.Spinner; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void updateSpinnerSelection(Spinner spinner, int selection) {
	ArrayAdapter<TGSelectableItem> adapter = (ArrayAdapter<TGSelectableItem>) spinner.getAdapter();
	spinner.setSelection(adapter.getPosition(new TGSelectableItem(Integer.valueOf(selection), null)), false);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:6,代码来源:TGMeasureRemoveDialog.java


示例20: showFilterDialogForRecording

import android.widget.Spinner; //导入方法依赖的package包/类
public static void showFilterDialogForRecording(final Context context, final String queryFilterText,
                                                final String logLevelText, final List<String> filterQuerySuggestions,
                                                final Callback<FilterQueryWithLevel> callback) {

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    @SuppressLint("InflateParams") View filterView = inflater.inflate(R.layout.dialog_recording_filter, null, false);

    // add suggestions to autocompletetextview
    final AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) filterView.findViewById(android.R.id.text1);
    autoCompleteTextView.setText(queryFilterText);

    SortedFilterArrayAdapter<String> suggestionAdapter = new SortedFilterArrayAdapter<String>(
            context, R.layout.list_item_dropdown, filterQuerySuggestions);
    autoCompleteTextView.setAdapter(suggestionAdapter);

    // set values on spinner to be the log levels
    final Spinner spinner = (Spinner) filterView.findViewById(R.id.spinner);

    // put the word "default" after whatever the default log level is
    CharSequence[] logLevels = context.getResources().getStringArray(R.array.log_levels);
    String defaultLogLevel = Character.toString(PreferenceHelper.getDefaultLogLevelPreference(context));
    int index = ArrayUtil.indexOf(context.getResources().getStringArray(R.array.log_levels_values), defaultLogLevel);
    logLevels[index] = logLevels[index].toString() + " " + context.getString(R.string.default_in_parens);

    ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(
            context, android.R.layout.simple_spinner_item, logLevels);
    adapter.setDropDownViewResource(R.layout.list_item_dropdown);
    spinner.setAdapter(adapter);

    // in case the user has changed it, choose the pre-selected log level
    spinner.setSelection(ArrayUtil.indexOf(context.getResources().getStringArray(R.array.log_levels_values),
            logLevelText));

    // create alertdialog for the "Filter..." button
    new MaterialDialog.Builder(context)
            .title(R.string.title_filter)
            .customView(filterView, true)
            .negativeText(android.R.string.cancel)
            .positiveText(android.R.string.ok)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    int logLevelIdx = spinner.getSelectedItemPosition();
                    String[] logLevelValues = context.getResources().getStringArray(R.array.log_levels_values);
                    String logLevelValue = logLevelValues[logLevelIdx];

                    String filterQuery = autoCompleteTextView.getText().toString();

                    callback.onCallback(new FilterQueryWithLevel(filterQuery, logLevelValue));
                }
            })
            .show();

}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:55,代码来源:DialogHelper.java



注:本文中的android.widget.Spinner.setSelection方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。