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


Java NumberPicker.getValue方法代码示例

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


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

示例1: NumberPickerAnswered

import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
 * Auxiliar function to get questions 8 to 10 value and set an error if they have not been
 * answered.
 *
 * @param i     Number of question
 * @param id    {@link RatingStars} id
 * @param text  {@link TextView} id of the question title
 * @param error {@link TextView} title of the first question title whose question has an error
 * @return <code>true</code> if an error was set; <code>false</code> otherwise.
 */
private TextView NumberPickerAnswered(int i, int id, int text, TextView error) {
    NumberPicker np = (NumberPicker) findViewById(id);
    int value = np.getValue();
    TextView tv = (TextView) findViewById(text);
    if (value == 0) {
        tv.setError("");
        if (error == null) {
            return tv;
        }
    } else {
        questions[i] = ((i == 7) ? (value - 1) * 10 : (value - 1));
        tv.setError(null);
    }
    return error;
}
 
开发者ID:Ana06,项目名称:medical-data-android,代码行数:26,代码来源:TestActivity.java

示例2: hasNumberPickerDisplayedValue

import android.widget.NumberPicker; //导入方法依赖的package包/类
public static Matcher<View> hasNumberPickerDisplayedValue(final Matcher<String> stringMatcher) {
    return new BoundedMatcher<View, NumberPicker>(NumberPicker.class) {

        @Override
        public void describeTo(final Description description) {
            description.appendText("With number picker displayed value: ");
            stringMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(final NumberPicker view) {
            int index = view.getValue();
            String[] displayedValues = view.getDisplayedValues();
            return stringMatcher.matches(displayedValues[index-1]);
        }
    };
}
 
开发者ID:WycliffeAssociates,项目名称:translationRecorder,代码行数:18,代码来源:TestUtils.java

示例3: onScrollStateChange

import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
public void onScrollStateChange(NumberPicker view, int scrollState) {
    this.scrollState_p = scrollState;
    int pos = getAdapterPosition();
    Log.d("zpos",String.valueOf(pos));
    Log.d("zScrollState",String.valueOf(scrollState));
    if (scrollState == SCROLL_STATE_IDLE){
        int actual_value = view.getValue();
        int adapterPosition = getAdapterPosition();
        String obj = mObjectsToCount.get(adapterPosition);
        mClickHandler.onValueChanged(obj, actual_value);
    }
}
 
开发者ID:ndleyton,项目名称:OneTwo,代码行数:14,代码来源:ListAdapter.java

示例4: getValue

import android.widget.NumberPicker; //导入方法依赖的package包/类
public int getValue()
{
	int num = 0;

	for(NumberPicker p : pickers)
	{
		num = num*10 + p.getValue();
	}

	return num;
}
 
开发者ID:e621Mobile,项目名称:E621Mobile,代码行数:12,代码来源:PageSelectorDialog.java

示例5: setResult

import android.widget.NumberPicker; //导入方法依赖的package包/类
void setResult() {
    EditText et = (EditText)findViewById(R.id.age);
    String checkEmpty = et.getText().toString();

    RadioGroup rg = (RadioGroup)findViewById(R.id.gender);
    RadioGroup rg2 = (RadioGroup)findViewById(R.id.reoccur);

    RadioButton rb1 = (RadioButton)findViewById(R.id.male);
    RadioButton rb2 = (RadioButton)findViewById(R.id.yes);

    NumberPicker numberPicker = (NumberPicker) findViewById(R.id.numberPicker);
    NumberPicker stringPicker = (NumberPicker) findViewById(R.id.stringPicker);

    Intent intent = new Intent();

    if (checkEmpty.matches("")){
        Toast.makeText(AgeScreen.this, "Age not set!",
                Toast.LENGTH_LONG).show();
        setResult(RESULT_CANCELED, intent);
    } else if (rg.getCheckedRadioButtonId() == -1) {
        Toast.makeText(AgeScreen.this, "Gender not selected!",
                Toast.LENGTH_LONG).show();
        setResult(RESULT_CANCELED, intent);
    } else if (rg2.getCheckedRadioButtonId() == -1) {
        Toast.makeText(AgeScreen.this, "Recurrence not selected!",
                Toast.LENGTH_LONG).show();
        setResult(RESULT_CANCELED, intent);
    } else {
        //age
        intent.putExtra("age",Integer.parseInt(checkEmpty));

        //gender
        if (rb1.isChecked())
            intent.putExtra("gender","male");
        else
            intent.putExtra("gender","female");

        //reoccurring
        if (rb2.isChecked())
            intent.putExtra("reoccurring",true);
        else
            intent.putExtra("reoccurring",false);

        //days
        int days = numberPicker.getValue();
        int date = stringPicker.getValue();
        if (date == 2)
            days *= 28; //months selected
        else if (date == 3)
            days *= 365; //years selected
        intent.putExtra("days",days);

        setResult(RESULT_OK, intent);
    }

    finish();
}
 
开发者ID:smajko,项目名称:what_are_those_app,代码行数:58,代码来源:AgeScreen.java

示例6: getPickerValue

import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
 * Clear focus before retrieving so that values inserted with
 * keyboard are taken into account.
*/
private int getPickerValue(NumberPicker picker) {
    picker.clearFocus();
    return picker.getValue();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:9,代码来源:MultiFieldTimePickerDialog.java


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