當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。