Java Code Examples for android.widget.AdapterView.OnItemSelectedListener

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: AddExternalNodeActivity.java

  22 
vote

private void loadConditionSpinner(){
  conditionSpinner=(Spinner)findViewById(R.id.node_condition_spinner);
  ArrayAdapter<String> conditionAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,CONDITIONS);
  conditionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  conditionSpinner.setAdapter(conditionAdapter);
  conditionSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long id){
      selectedCondition=CONDITIONS[pos];
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
}
 

Example 2

From project RoboBinding, under directory /robobinding/src/main/java/org/robobinding/viewattribute/adapterview/.

Source file: SelectedItemPositionAttribute.java

  22 
vote

@Override protected void observeChangesOnTheView(final ValueModel<Integer> valueModel){
  adapterViewListeners.addOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      valueModel.setValue(position);
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
      valueModel.setValue(AdapterView.INVALID_POSITION);
    }
  }
);
}
 

Example 3

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/base/.

Source file: DocumentSelectionBase.java

  20 
vote

private void initialiseView(){
  languageList=new ArrayList<Language>();
  displayedDocuments=new ArrayList<Book>();
  ArrayAdapter<Book> listArrayAdapter=new DocumentItemAdapter(this,LIST_ITEM_TYPE,displayedDocuments,isInstallStatusIconsShown);
  setListAdapter(listArrayAdapter);
  documentTypeSpinner=(Spinner)findViewById(R.id.documentTypeSpinner);
  setInitialDocumentType();
  documentTypeSpinner.setSelection(selectedDocumentFilterNo);
  documentTypeSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      selectedDocumentFilterNo=position;
      DocumentSelectionBase.this.filterDocuments();
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
{
    langSpinner=(Spinner)findViewById(R.id.languageSpinner);
    langSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
      @Override public void onItemSelected(      AdapterView<?> parent,      View view,      int position,      long id){
        selectedLanguageNo=position;
        lastSelectedLanguage=languageList.get(selectedLanguageNo);
        DocumentSelectionBase.this.filterDocuments();
      }
      @Override public void onNothingSelected(      AdapterView<?> arg0){
      }
    }
);
    langArrayAdapter=new ArrayAdapter<Language>(this,android.R.layout.simple_spinner_item,languageList);
    langArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    langSpinner.setAdapter(langArrayAdapter);
  }
}
 

Example 4

From project android-client, under directory /xwiki-android-components/src/org/xwiki/android/components/search/.

Source file: SearchActivity.java

  20 
vote

private void loadWikiList(){
  Wikis ws=request.requestWikis();
  wikiList=new String[ws.getWikis().size()];
  for (int i=0; i < wikiList.length; i++) {
    wikiList[i]=ws.getWikis().get(i).getName();
  }
  Spinner spinner=(Spinner)findViewById(R.id.spinner_wikilist);
  ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_spinner_item,wikiList);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long id){
      wikiName=parent.getItemAtPosition(pos).toString();
      loadSpaceList(wikiName);
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
}
 

Example 5

From project android-joedayz, under directory /Proyectos/TaxiLab5/src/pe/joedayz/samples/.

Source file: SolicitarTaxi.java

  20 
vote

@Override public void onStart(){
  try {
    super.onStart();
    dbHelper=new DatabaseHelper(this);
    Cursor c=dbHelper.getAllDistritos();
    startManagingCursor(c);
    SimpleCursorAdapter ca=new SimpleCursorAdapter(this,R.layout.distritospinnerrow,c,new String[]{DatabaseHelper.colDistritoName,"_id"},new int[]{R.id.txtDistritoName});
    spinDistritoOrigen.setAdapter(ca);
    spinDistritoOrigen.setOnItemSelectedListener(new OnItemSelectedListener(){
      public void onItemSelected(      AdapterView<?> parent,      View selectedView,      int position,      long id){
      }
      public void onNothingSelected(      AdapterView<?> arg0){
      }
    }
);
    spinDistritoDestino.setAdapter(ca);
    spinDistritoDestino.setOnItemSelectedListener(new OnItemSelectedListener(){
      public void onItemSelected(      AdapterView<?> parent,      View selectedView,      int position,      long id){
      }
      public void onNothingSelected(      AdapterView<?> arg0){
      }
    }
);
  }
 catch (  Exception ex) {
    CatchError(ex.toString());
  }
}
 

Example 6

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/core/activity/.

Source file: HelpActivity.java

  20 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.help);
  ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.help_screens,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mHelpSpinner.setAdapter(adapter);
  mHelpSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onNothingSelected(    AdapterView<?> arg0){
    }
    public void onItemSelected(    AdapterView<?> parent,    View v,    int position,    long id){
      int resId=HelpActivity.this.getResources().getIdentifier("help" + position,cStringType,cPackage);
      mHelpContent.setText(HelpActivity.this.getText(resId));
      updateNavigationButtons();
    }
  }
);
  mPrevious.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      int position=mHelpSpinner.getSelectedItemPosition();
      mHelpSpinner.setSelection(position - 1);
    }
  }
);
  mNext.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      int position=mHelpSpinner.getSelectedItemPosition();
      mHelpSpinner.setSelection(position + 1);
    }
  }
);
  setSelectionFromBundle(getIntent().getExtras());
}
 

Example 7

From project AndroidBillingLibrary, under directory /DungeonsRedux/src/net/robotmedia/billing/example/.

Source file: Dungeons.java

  20 
vote

private void setupWidgets(){
  mBuyButton=(Button)findViewById(R.id.buy_button);
  mBuyButton.setEnabled(false);
  mBuyButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (mSelectedItem.managed != Managed.SUBSCRIPTION) {
        BillingController.requestPurchase(Dungeons.this,mSelectedItem.sku,true,null);
      }
 else {
        BillingController.requestSubscription(Dungeons.this,mSelectedItem.sku,true,null);
      }
    }
  }
);
  mSelectItemSpinner=(Spinner)findViewById(R.id.item_choices);
  mCatalogAdapter=new CatalogAdapter(this,CatalogEntry.CATALOG);
  mSelectItemSpinner.setAdapter(mCatalogAdapter);
  mSelectItemSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      mSelectedItem=CatalogEntry.CATALOG[position];
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  mOwnedItemsTable=(ListView)findViewById(R.id.owned_items);
}
 

Example 8

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/settings/.

Source file: UserDictionaryEditorActivity.java

  20 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.user_dictionary_editor);
  mLangs=(Spinner)findViewById(R.id.user_dictionay_langs);
  mLangs.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      mSelectedLocale=arg0.getItemAtPosition(arg2).toString();
      fillWordsList();
    }
    public void onNothingSelected(    AdapterView<?> arg0){
      Log.d(TAG,"No locale selected");
      mSelectedLocale=null;
    }
  }
);
  findViewById(R.id.add_user_word).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showAddOrEditDialog(null);
    }
  }
);
  findViewById(R.id.backup_words).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      new BackupUserWordsAsyncTask(UserDictionaryEditorActivity.this).execute();
    }
  }
);
  findViewById(R.id.restore_words).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      new RestoreUserWordsAsyncTask(UserDictionaryEditorActivity.this).execute();
    }
  }
);
  TextView emptyView=(TextView)findViewById(R.id.empty_user_dictionary);
  ListView listView=getListView();
  listView.setFastScrollEnabled(true);
  listView.setEmptyView(emptyView);
}
 

Example 9

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: RequestCoinsFragment.java

  20 
vote

@Override public void onResume(){
  super.onResume();
  amountView.setListener(new CurrencyAmountView.Listener(){
    public void changed(){
      updateView();
    }
    public void done(){
    }
    public void focusChanged(    final boolean hasFocus){
    }
  }
);
  addressView.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    final AdapterView<?> parent,    final View view,    final int position,    final long id){
      updateView();
    }
    public void onNothingSelected(    final AdapterView<?> parent){
    }
  }
);
  includeLabelView.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    public void onCheckedChanged(    final CompoundButton buttonView,    final boolean isChecked){
      updateView();
    }
  }
);
  updateView();
}
 

Example 10

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/content/bricks/.

Source file: SetCostumeBrick.java

  20 
vote

public View getView(final Context context,int brickId,BaseAdapter adapter){
  view=View.inflate(context,R.layout.brick_set_costume,null);
  Spinner costumebrickSpinner=(Spinner)view.findViewById(R.id.setcostume_spinner);
  costumebrickSpinner.setAdapter(createCostumeAdapter(context));
  costumebrickSpinner.setClickable(true);
  costumebrickSpinner.setFocusable(true);
  costumebrickSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (position == 0) {
        costumeData=null;
      }
 else {
        costumeData=(CostumeData)parent.getItemAtPosition(position);
      }
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  if (sprite.getCostumeDataList().contains(costumeData)) {
    costumebrickSpinner.setSelection(sprite.getCostumeDataList().indexOf(costumeData) + 1,true);
  }
 else {
    costumebrickSpinner.setSelection(0);
  }
  if (sprite.getName().equals(context.getString(R.string.background))) {
    TextView textView=(TextView)view.findViewById(R.id.tv_set_costume);
    textView.setText(R.string.brick_set_background);
  }
  return view;
}
 

Example 11

From project convertcsv, under directory /ConvertCSV/src/org/openintents/convertcsv/shoppinglist/.

Source file: ConvertCsvActivity.java

  20 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (mConvertInfo != null) {
    mConvertInfo.setText(R.string.convert_all_shoppinglists);
  }
  if (mSpinner != null) {
    mSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
      @Override public void onItemSelected(      AdapterView<?> parentView,      View selectedItemView,      int position,      long id){
        updateInfo();
      }
      @Override public void onNothingSelected(      AdapterView<?> parentView){
        updateInfo();
      }
    }
);
  }
}
 

Example 12

From project droidtv, under directory /src/com/chrulri/droidtv/.

Source file: ChannelsActivity.java

  20 
vote

private void onCreateImpl(){
  setContentView(R.layout.channels);
  mSpinner=(Spinner)findViewById(R.id.spinner);
  mSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      loadChannels((String)parent.getSelectedItem());
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
      loadChannels(null);
    }
  }
);
  mListView=(ListView)findViewById(R.id.listView);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      watchChannel((int)id);
    }
  }
);
  loadChannelLists();
  setChannelList(null);
  if (mSpinner.getAdapter().getCount() == 0) {
    PreferenceUtils.openSettings(this);
  }
}
 

Example 13

From project fauxclock, under directory /src/com/teamkang/fauxclock/factories/.

Source file: GpuFactory.java

  20 
vote

public void createGpuView(){
  LayoutInflater inf=LayoutInflater.from(mContext);
  me=inf.inflate(R.layout.gpu_control,null);
  gpuLayout=(RelativeLayout)me.findViewById(R.id.gpuControl);
  gpuGovSpinner=(Spinner)me.findViewById(R.id.gpu_gov_spinner);
  gpuIOFracSeek=(SeekBar)me.findViewById(R.id.seekbar_gpu_io_frac);
  gpuIOFracValue=(TextView)me.findViewById(R.id.gpu_io_frac_value);
  if (PhoneManager.supportsGpu()) {
    gpu=new GpuController(mContext);
    ArrayAdapter<String> gpuGovSpinnerAdapter=new ArrayAdapter<String>(mContext,android.R.layout.simple_spinner_item,gpu.govs);
    gpuGovSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    gpuGovSpinner.setAdapter(gpuGovSpinnerAdapter);
    gpuGovSpinner.setSelection(gpuGovSpinnerAdapter.getPosition(gpu.getCurrentActiveGov()));
    gpuGovSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
      public void onItemSelected(      AdapterView<?> parent,      View view,      int position,      long id){
        String selectedGov=(String)parent.getSelectedItem();
        gpu.setGpuGoverner(selectedGov);
      }
      public void onNothingSelected(      AdapterView<?> parent){
      }
    }
);
    gpuIOFracSeek.setMax(100);
    gpuIOFracSeek.setProgress(gpu.getGpuIOFraction());
    gpuIOFracSeek.setOnSeekBarChangeListener(this);
    gpuIOFracValue.setText(gpu.getGpuIOFraction() + "");
  }
 else {
    gpuLayout.setVisibility(View.GONE);
    gpuGovSpinner.setVisibility(View.GONE);
    gpuIOFracSeek.setVisibility(View.GONE);
    gpuIOFracValue.setVisibility(View.GONE);
  }
  tabTitle=(TextView)me.findViewById(R.id.tab_title);
  tabTitle.setText("GPU Control");
}
 

Example 14

From project GnucashMobile, under directory /GnucashMobile/src/org/gnucash/android/ui/transactions/.

Source file: NewTransactionFragment.java

  20 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  ActionBar actionBar=getSherlockActivity().getSupportActionBar();
  actionBar.setHomeButtonEnabled(true);
  actionBar.setDisplayHomeAsUpEnabled(true);
  actionBar.setTitle(R.string.title_add_transaction);
  String[] from=new String[]{DatabaseHelper.KEY_NAME};
  int[] to=new int[]{android.R.id.text1};
  mAccountsDbAdapter=new AccountsDbAdapter(getActivity());
  mCursor=mAccountsDbAdapter.fetchAllAccounts();
  mCursorAdapter=new SimpleCursorAdapter(getActivity(),android.R.layout.simple_spinner_item,mCursor,from,to,0);
  mCursorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mAccountsSpinner.setAdapter(mCursorAdapter);
  mAccountsSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      String currencyCode=mAccountsDbAdapter.getCurrency(id);
      Currency currency=Currency.getInstance(currencyCode);
      mCurrencyTextView.setText(currency.getSymbol(Locale.getDefault()));
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mTransactionId=getArguments().getLong(SELECTED_TRANSACTION_ID);
  mTransactionsDbAdapter=new TransactionsDbAdapter(getActivity());
  mTransaction=mTransactionsDbAdapter.getTransaction(mTransactionId);
  setListeners();
  if (mTransaction == null)   initalizeViews();
 else   initializeViewsWithTransaction();
}
 

Example 15

From project GSM-Signal-Tracking-, under directory /gpstracker/src/nl/sogeti/android/gpstracker/actions/.

Source file: ShareTrack.java

  20 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.sharedialog);
  mTrackUri=getIntent().getData();
  calculator=new StatisticsCalulator(this,new UnitsI18n(this,null));
  mFileNameView=(EditText)findViewById(R.id.fileNameField);
  mTweetView=(EditText)findViewById(R.id.tweetField);
  mShareTypeSpinner=(Spinner)findViewById(R.id.shareTypeSpinner);
  ArrayAdapter<CharSequence> shareTypeAdapter=ArrayAdapter.createFromResource(this,R.array.sharetype_choices,android.R.layout.simple_spinner_item);
  shareTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mShareTypeSpinner.setAdapter(shareTypeAdapter);
  mShareTargetSpinner=(Spinner)findViewById(R.id.shareTargetSpinner);
  mShareTypeSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int position,    long arg3){
      adjustTargetToType(position);
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  int lastType=PreferenceManager.getDefaultSharedPreferences(this).getInt(Constants.EXPORT_TYPE,EXPORT_TYPE_KMZ);
  mShareTypeSpinner.setSelection(lastType);
  adjustTargetToType(lastType);
  mFileNameView.setText(queryForTrackName());
  Button okay=(Button)findViewById(R.id.okayshare_button);
  okay.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      share();
    }
  }
);
  Button cancel=(Button)findViewById(R.id.cancelshare_button);
  cancel.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      ShareTrack.this.finish();
    }
  }
);
}
 

Example 16

From project jamendo-android, under directory /src/com/teleca/jamendo/activity/.

Source file: AlbumActivity.java

  20 
vote

@SuppressWarnings("unchecked") private void loadReviews(){
  ArrayList<Review> reviews=(ArrayList<Review>)getIntent().getSerializableExtra("reviews");
  mReviewAdapter.setList(reviews);
  final ArrayList<String> langs=Helper.getLanguageCodes(reviews);
  langs.add(0,"all");
  ArrayAdapter<String> languageAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,Helper.getLanguageNames(langs,AlbumActivity.this));
  languageAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mLanguageSpinner.setAdapter(languageAdapter);
  mLanguageSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int position,    long arg3){
      mReviewAdapter.setLang(langs.get(position));
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
      mReviewAdapter.setLang("all");
    }
  }
);
}
 

Example 17

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/app/.

Source file: ScreenOrientation.java

  20 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.screen_orientation);
  mOrientation=(Spinner)findViewById(R.id.orientation);
  ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.screen_orientations,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mOrientation.setAdapter(adapter);
  mOrientation.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      setRequestedOrientation(mOrientationValues[position]);
    }
    public void onNothingSelected(    AdapterView<?> parent){
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
  }
);
}
 

Example 18

From project mWater-Android-App, under directory /android/src/co/mwater/clientapp/ui/.

Source file: ChlorineRecordActivity.java

  20 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.chlorine_results_activity);
  presentBox=(CheckBox)findViewById(R.id.present);
  mgPerLSpinner=(Spinner)findViewById(R.id.mgPerLSpinner);
  mgPerLCustom=(TextView)findViewById(R.id.mgPerLCustom);
  presentBox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      mgPerLSpinner.setVisibility(isChecked ? TextView.VISIBLE : TextView.INVISIBLE);
      mgPerLCustom.setVisibility(isChecked && mgPerLSpinner.getSelectedItemPosition() == 6 ? TextView.VISIBLE : TextView.INVISIBLE);
      findViewById(R.id.concentration_label).setVisibility(isChecked ? TextView.VISIBLE : TextView.INVISIBLE);
    }
  }
);
  mgPerLSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      updateCustomField();
    }
    public void onNothingSelected(    AdapterView<?> parent){
      updateCustomField();
    }
  }
);
}
 

Example 19

From project packages_apps_Calendar, under directory /src/com/android/calendar/.

Source file: EventInfoFragment.java

  20 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  mReminderChangeListener=new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      Integer prevValue=(Integer)parent.getTag();
      if (prevValue == null || prevValue != position) {
        parent.setTag(position);
        mUserModifiedReminders=true;
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
;
  if (savedInstanceState != null) {
    mIsDialog=savedInstanceState.getBoolean(BUNDLE_KEY_IS_DIALOG,false);
    mWindowStyle=savedInstanceState.getInt(BUNDLE_KEY_WINDOW_STYLE,DIALOG_WINDOW_STYLE);
  }
  if (mIsDialog) {
    applyDialogParams();
  }
  mContext=getActivity();
}
 

Example 20

From project platform_packages_apps_calendar, under directory /src/com/android/calendar/.

Source file: EventInfoFragment.java

  20 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  mReminderChangeListener=new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      Integer prevValue=(Integer)parent.getTag();
      if (prevValue == null || prevValue != position) {
        parent.setTag(position);
        mUserModifiedReminders=true;
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
;
  if (savedInstanceState != null) {
    mIsDialog=savedInstanceState.getBoolean(BUNDLE_KEY_IS_DIALOG,false);
    mWindowStyle=savedInstanceState.getInt(BUNDLE_KEY_WINDOW_STYLE,DIALOG_WINDOW_STYLE);
  }
  if (mIsDialog) {
    applyDialogParams();
  }
  mContext=getActivity();
}
 

Example 21

From project SchoolPlanner4Untis, under directory /src/edu/htl3r/schoolplanner/gui/selectScreen/.

Source file: AutoselectDialog.java

  20 
vote

private void initSpinner(){
  typeSpinner=(Spinner)findViewById(R.id.autoselect_dialog_type_spinner);
  valueSpinner=(Spinner)findViewById(R.id.autoselect_dialog_value_spinner);
  typeSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (lastSelectedPosition > -1 && lastSelectedPosition != position) {
        String selectedTypeEntry=typeEntries[position];
        initSpinner(valueSpinner,spinnerWire.get(selectedTypeEntry));
        autoSelectSet.setAutoSelectType(selectedTypeEntry);
      }
      lastSelectedPosition=position;
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  valueSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      ViewType viewType=spinnerWire.get(autoSelectSet.getAutoSelectType()).get(position);
      autoSelectSet.setAutoSelectValue(viewType.getId());
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}
 

Example 22

From project SWE12-Drone, under directory /catroid/src/at/tugraz/ist/catroid/content/bricks/.

Source file: SetCostumeBrick.java

  20 
vote

public View getView(final Context context,int brickId,BaseAdapter adapter){
  view=View.inflate(context,R.layout.brick_set_costume,null);
  Spinner costumebrickSpinner=(Spinner)view.findViewById(R.id.setcostume_spinner);
  costumebrickSpinner.setAdapter(createCostumeAdapter(context));
  costumebrickSpinner.setClickable(true);
  costumebrickSpinner.setFocusable(true);
  costumebrickSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (position == 0) {
        costumeData=null;
      }
 else {
        costumeData=(CostumeData)parent.getItemAtPosition(position);
      }
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  if (sprite.getCostumeDataList().contains(costumeData)) {
    costumebrickSpinner.setSelection(sprite.getCostumeDataList().indexOf(costumeData) + 1,true);
  }
 else {
    costumebrickSpinner.setSelection(0);
  }
  if (sprite.getName().equals(context.getString(R.string.background))) {
    TextView textView=(TextView)view.findViewById(R.id.tv_set_costume);
    textView.setText(R.string.brick_set_background);
  }
  return view;
}
 

Example 23

From project Traktoid, under directory /Traktoid/src/com/florianmski/tracktoid/ui/fragments/.

Source file: TrendingFragment.java

  20 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  getStatusView().show().text("Retrieving trending shows,\nPlease wait...");
  cf.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int position,    long arg3){
      setTitle(shows.get(position).title);
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  cf.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int position,    long arg3){
      getFragmentManager().beginTransaction().replace(R.id.fragment_show,ShowFragment.newInstance(shows.get(position))).commit();
    }
  }
);
  if (savedInstanceState == null) {
    commonTask=new ShowsTask(tm,this,new ShowsListener(){
      @Override public void onShows(      ArrayList<TvShow> shows){
        TrendingFragment.this.shows=shows;
        setAdapter();
      }
    }
,tm.showService().trending(),false);
    commonTask.execute();
  }
 else   setAdapter();
}
 

Example 24

From project zirco-browser, under directory /src/org/zirco/ui/activities/preferences/.

Source file: BaseSpinnerCustomPreferenceActivity.java

  20 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Window w=getWindow();
  w.requestFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.base_spinner_custom_preference_activity);
  w.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,android.R.drawable.ic_dialog_map);
  mCustomEditText=(EditText)findViewById(R.id.BaseSpinnerCustomPreferenceEditText);
  mSpinner=(Spinner)findViewById(R.id.BaseSpinnerCustomPreferenceSpinner);
  mSpinner.setPromptId(getSpinnerPromptId());
  ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,getSpinnerValuesArrayId(),android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mSpinner.setAdapter(adapter);
  setSpinnerValueFromPreferences();
  mSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int position,    long id){
      onSpinnerItemSelected(position);
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  Button okBtn=(Button)findViewById(R.id.BaseSpinnerCustomPreferenceOk);
  okBtn.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      onOk();
      finish();
    }
  }
);
  Button cancelBtn=(Button)findViewById(R.id.BaseSpinnerCustomPreferenceCancel);
  cancelBtn.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      finish();
    }
  }
);
}
 

Example 25

From project androidquery, under directory /src/com/androidquery/.

Source file: AbstractAQuery.java

  19 
vote

/** 
 * Register a callback method for when an item is selected. 
 * @param listener The item selected listener.
 * @return self
 */
public T itemSelected(OnItemSelectedListener listener){
  if (view instanceof AdapterView) {
    AdapterView<?> alv=(AdapterView<?>)view;
    alv.setOnItemSelectedListener(listener);
  }
  return self();
}
 

Example 26

From project shoppinglist, under directory /ShoppingList/src/org/openintents/shopping/ui/.

Source file: ShoppingActivity.java

  19 
vote

protected void showListFilter(final View v){
  QuickSelectMenu popup=new QuickSelectMenu(this,v);
  int i_list;
  Menu menu=popup.getMenu();
  if (menu == null) {
    return;
  }
  mCursorShoppingLists.requery();
  int count=mCursorShoppingLists.getCount();
  mCursorShoppingLists.moveToFirst();
  for (i_list=0; i_list < count; i_list++) {
    String name=mCursorShoppingLists.getString(mStringListFilterNAME);
    menu.add(0,i_list,Menu.NONE,name);
    mCursorShoppingLists.moveToNext();
  }
  popup.setOnItemSelectedListener(new QuickSelectMenu.OnItemSelectedListener(){
    public void onItemSelected(    CharSequence name,    int pos){
      setSelectedListPos(pos);
    }
  }
);
  popup.show();
}