本文整理汇总了Java中android.widget.AdapterView.getId方法的典型用法代码示例。如果您正苦于以下问题:Java AdapterView.getId方法的具体用法?Java AdapterView.getId怎么用?Java AdapterView.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.AdapterView
的用法示例。
在下文中一共展示了AdapterView.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (parent.getId()) {
case R.id.edit_text_size:
mLabel.setTextSize(positionToTextSize(position));
break;
case R.id.edit_outline_size:
mLabel.setOutlineSize(positionToOutlineSize(position));
break;
case R.id.edit_font_family:
String displayName = mFontFamilyNameList.get(position);
mSelectedFontFamily = mFontFamilySet.getFontFamilyFromDisplayName(displayName);
mLabel.setFamilyName(mSelectedFontFamily.name);
updateBoldAndItalic();
break;
default:
break;
}
}
示例2: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long l) {
try {
String finalSelectedItem;
switch (parent.getId()) {
case R.id.dotRadiusPortraitSpinner:
finalSelectedItem = parent.getItemAtPosition(position).toString();
Common.putSettingInt("dotRadius", Integer.valueOf(finalSelectedItem));
Common.areSettingsChanged = true;
Common.defaultTextSpeech.speechText(finalSelectedItem);
break;
case R.id.dotRadiusLandscapeSpinner:
finalSelectedItem = parent.getItemAtPosition(position).toString();
Common.putSettingInt("dotLandscapeRadius", Integer.valueOf(finalSelectedItem));
Common.areSettingsChanged = true;
Common.defaultTextSpeech.speechText(finalSelectedItem);
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
try{
String finalSelectedItem;
switch (parent.getId()) {
case R.id.listOfAllTTSs:
finalSelectedItem = parent.getItemAtPosition(position).toString();
Common.putSettingString("defaultTTSEngine", ttsEnginesListPackages.get(listOfAllTTSsAdapter.getPosition(finalSelectedItem)));
Common.areSettingsChanged = true;
//Now change the tts with a new object
Common.reInitDefaultTextSpeech();
Common.defaultTextSpeech.speechText(finalSelectedItem);
break;
case R.id.soundOverBrailleDot:
finalSelectedItem = parent.getItemAtPosition(position).toString();
Common.putSettingInt("defaultBrailleDotSound", position);
Common.areSettingsChanged = true;
Common.defaultTextSpeech.speechText(finalSelectedItem);
break;
}
} catch(Exception e){
e.printStackTrace();
}
}
示例4: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
try {
String finalSelectedItem;
switch (parent.getId()) {
case R.id.defaultKeyboardLanguageSpinner:
finalSelectedItem = parent.getItemAtPosition(position).toString();
Common.defaultTextSpeech.speechText(finalSelectedItem);
Common.putSettingInt("defaultKeyboardLanguage", defaultSelectedLanguagesTags.get(position));
Common.areSettingsChanged = true;
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (!ViewUtils.isFastDoubleClick() && this.activity != null) {
switch (parent.getId()) {
case R.id.lv_result:
Fragment addMaterialFragment = AddMaterialFragment.newInstance((
(FoodWithUnit) this.mResultAdapter.getItem(position)).code);
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
transaction.add(addMaterialFragment, "addMaterialFragment");
transaction.commitAllowingStateLoss();
return;
default:
return;
}
}
}
示例6: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
@SuppressWarnings("ConstantConditions")
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Object item = "";
switch (parent.getId()) {
case R.id.fragment_components_menus_spinner_timer:
item = ((TimerAdapter) parent.getAdapter()).getSelectedItem().value;
break;
case R.id.fragment_components_menus_spinner_when:
case R.id.fragment_components_menus_spinner_colors:
item = parent.getAdapter().getItem(position);
break;
}
Toast.makeText(getActivity(), "Selected: " + item, Toast.LENGTH_SHORT).show();
}
示例7: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> spinner, View arg1, int arg2, long arg3) {
int spinnerId = spinner.getId();
if (spinnerId == R.id.filter_action) {
int action = Filter.getActionForPosition(actionSpinner.getSelectedItemPosition()) ;
if(action == Filter.ACTION_REPLACE || action == Filter.ACTION_AUTO_ANSWER) {
replaceContainer.setVisibility(View.VISIBLE);
if(action == Filter.ACTION_REPLACE) {
replaceSpinner.setVisibility(View.VISIBLE);
replaceTextEditor.setHint("");
}else {
replaceSpinner.setVisibility(View.GONE);
replaceTextEditor.setHint(R.string.optional_sip_code);
}
}else {
replaceContainer.setVisibility(View.GONE);
}
} else if (spinnerId == R.id.matcher_type) {
if(initMatcherSpinner) {
matchesTextEditor.setText("");
}else {
initMatcherSpinner = true;
}
} else if (spinnerId == R.id.replace_type) {
if(initReplaceSpinner) {
replaceTextEditor.setText("");
}else {
initReplaceSpinner = true;
}
}
matchesTextEditor.setVisibility(matcherNeedsText() ? View.VISIBLE : View.GONE);
checkFormValidity();
}
示例8: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
// An item was selected. You can retrieve the selected item using
// parent.getItemAtPosition(pos)
int viewid = parent.getId();
if (viewid == R.id.fontcolor_spinner) {
int color = Color.BLACK;
String item = String.valueOf(parent.getItemAtPosition(pos));
switch (item) {
case "BLUE":
color = Color.BLUE;
break;
case "RED":
color = Color.RED;
break;
case "YELLOW":
color = Color.YELLOW;
break;
}
mMongolLabelMatchParent.setTextColor(color);
mMongolLabelWrapContent.setTextColor(color);
} else if (viewid == R.id.fontsize_spinner) {
int size = Integer.parseInt(parent.getSelectedItem().toString());
mMongolLabelMatchParent.setTextSize(size);
mMongolLabelWrapContent.setTextSize(size);
// } else if (viewid == R.id.alignment_spinner) {
// int gravity = Gravity.TOP;
// String item = String.valueOf(parent.getItemAtPosition(pos));
// switch (item) {
// case "CENTER":
// gravity = Gravity.CENTER;
// break;
// case "BOTTOM":
// gravity = Gravity.BOTTOM;
// break;
// }
// mMongolLabelMatchParent.setGravity(gravity);
// mMongolLabelWrapContent.setGravity(gravity);
}
}
示例9: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
Spinner spinner = (Spinner) parent;
final int selIndex = spinner.getSelectedItemPosition();
boolean updated = false;
if (parent.getId() == R.id.scheduledSwapUpdate_spinner) {
if (mUpdatePatternIndex != selIndex) {
Log.d(TAG, "onItemSelected [update-rate]: " + selIndex);
mUpdatePatternIndex = selIndex;
updated = true;
}
} else if (parent.getId() == R.id.scheduledSwapAhead_spinner) {
if (mFramesAheadIndex != selIndex) {
Log.d(TAG, "onItemSelected [frames-ahead]: " + selIndex);
mFramesAheadIndex = selIndex;
updated = true;
}
} else {
throw new RuntimeException("Unknown spinner");
}
if (mRenderThread == null) {
// huh
Log.d(TAG, "In onItemSelected while the activity is paused");
} else if (updated) {
RenderHandler rh = mRenderThread.getHandler();
if (rh != null) {
rh.sendSetParameters(mUpdatePatternIndex, mFramesAheadIndex);
}
}
}
示例10: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
//Currency Format
NumberFormat formatter = NumberFormat.getCurrencyInstance();
if (arg0.getId() == R.id.book_spinner) {
//Save the choice as a string
Object item = arg0.getItemAtPosition(arg2);
String title = item.toString();
//Loop through the available books list to see if the title matches
for(int i=0; i<availableBooks.size(); i++){
//if it matches change the text of the details
if(availableBooks.get(i).getTitle().equals(title)){
TextView main = (TextView) findViewById(R.id.main);
main.setText("");
main.append("Title: " + availableBooks.get(i).getTitle() + "\n");
main.append("Author: " + availableBooks.get(i).getAuthor() + "\n");
main.append("ISBN: " + availableBooks.get(i).getIsbn() + "\n");
main.append("Cost Per Hour: " + formatter.format(availableBooks.get(i).getPrice()));
cost = availableBooks.get(i).getPrice();
}
}
//get the book in the array with this Title
}
}
示例11: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
switch (adapterView.getId()) {
case R.id.server_browser_list:
DeviceWrapper deviceWrapper = (DeviceWrapper) adapterView.getItemAtPosition(position);
mListener.onServerSelected(deviceWrapper.getDevice());
break;
case R.id.bookmarks_list:
BookmarkWrapper bookmarkWrapper = (BookmarkWrapper) adapterView.getItemAtPosition(position);
mListener.onBookmarkSelected(bookmarkWrapper.getBookmark());
break;
}
}
示例12: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (!ViewUtils.isFastDoubleClick() && this.activity != null) {
switch (parent.getId()) {
case R.id.lv_result:
FoodWithUnit food = (FoodWithUnit) this.mResultAdapter.getItem(position);
if (this.isAddDiet) {
Fragment addDietFragment = AddDietFragment.newInstance(this.mTimeType,
this.record_on, food.code);
addDietFragment.setChangeListener(new onChangeListener() {
public void onFinish() {
SearchFoodActivity.this.finish();
}
});
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
transaction.add(addDietFragment, "addDietFragment");
transaction.commitAllowingStateLoss();
return;
}
FoodDetailActivity.comeOnBaby(this.ctx, food.code, true);
return;
case R.id.gv_hot:
this.mQueryString = (String) this.hotSearchList.get(position);
doFastSearch(this.mQueryString);
return;
default:
return;
}
}
}
示例13: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id)
{
// An item was selected. You can retrieve the selected item
// using parent.getItemAtPosition(pos)
// Check id
switch (parent.getId())
{
case R.id.spinner:
String item = (String)parent.getItemAtPosition(pos);
// Get length
length = Integer.parseInt(item);
// Remove the unused slots
if (letters != null)
{
for (int i = 0; i < letters.getChildCount(); i++)
{
TextView text = (TextView)letters.getChildAt(i);
if (i < length)
text.setVisibility(View.VISIBLE);
// Temporarily remove the text change listener to
// stop unexpected consequences
else
{
text.setVisibility(View.GONE);
text.removeTextChangedListener(this);
text.setText("");
text.addTextChangedListener(this);
}
}
}
}
}
示例14: onItemClick
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
// An item was selected. You can retrieve the selected item
// using parent.getItemAtPosition(pos)
// Check id
switch (parent.getId())
{
case R.id.list:
String word = (String)parent.getItemAtPosition(position);
String s = word.toUpperCase(Locale.getDefault());
// Fill the letters in the slots and temporarily remove
// the text change listener to stop unexpected
// consequences
for (int i = 0; i < length; i++)
{
TextView text = (TextView)letters.getChildAt(i);
text.removeTextChangedListener(this);
text.setText(s.substring(i, i + 1));
text.addTextChangedListener(this);
}
// Start the web search
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(WORD, word);
startActivity(intent);
}
}
示例15: onItemSelected
import android.widget.AdapterView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
ImageView.ScaleType scaleType = ScaleTypeConverter.convert(mScaleTypes[position]);
switch (parent.getId()) {
case R.id.spinner_start_scaletype:
mImageView.setScaleType(scaleType);
break;
case R.id.spinner_end_scaletype:
mEndScaleType = scaleType;
break;
}
}