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


Java AdapterView.getId方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:olgamiller,项目名称:SSTVEncoder2,代码行数:20,代码来源:EditTextActivity.java

示例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();
    }
}
 
开发者ID:MohammadAlBanna,项目名称:Swift-Braille-Soft-keyboard,代码行数:23,代码来源:DotsStyleActivity.java

示例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();
    }
}
 
开发者ID:MohammadAlBanna,项目名称:Swift-Braille-Soft-keyboard,代码行数:25,代码来源:SoundsActivity.java

示例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();
    }
}
 
开发者ID:MohammadAlBanna,项目名称:Swift-Braille-Soft-keyboard,代码行数:17,代码来源:KeyboardLanguagesActivity.java

示例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;
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:CookSearchActivity.java

示例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();
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:16,代码来源:MenusFragment.java

示例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();
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:35,代码来源:EditFilter.java

示例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);
        }
    }
 
开发者ID:suragch,项目名称:mongol-library,代码行数:41,代码来源:MongolLabelActivity.java

示例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);
        }
    }
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:33,代码来源:ScheduledSwapActivity.java

示例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
    }

}
 
开发者ID:Mikerr1111,项目名称:Library-System-Android,代码行数:35,代码来源:BookResults.java

示例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;
    }
}
 
开发者ID:stephenmcgruer,项目名称:simple-upnp,代码行数:14,代码来源:ServerBrowserFragment.java

示例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;
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:SearchFoodActivity.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:billthefarmer,项目名称:crossword,代码行数:38,代码来源:Main.java

示例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);
    }
}
 
开发者ID:billthefarmer,项目名称:crossword,代码行数:31,代码来源:Main.java

示例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;
    }
}
 
开发者ID:Omega-R,项目名称:OmegaRoundingImageView,代码行数:14,代码来源:MainActivity.java


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