List of usage examples for android.widget ToggleButton performClick
@Override public boolean performClick()
From source file:ru.orangesoftware.financisto.activity.CategorySelector.java
private void initAutoCompleteFilter(final AutoCompleteTextView filterTxt) { // init only after it's toggled autoCompleteAdapter = TransactionUtils.createCategoryFilterAdapter(activity, db); filterTxt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_FILTER); filterTxt.setThreshold(1);/*from ww w. j av a 2s .c o m*/ filterTxt.setOnFocusChangeListener((view, hasFocus) -> { if (hasFocus) { filterTxt.setAdapter(requireNonNull(autoCompleteAdapter)); filterTxt.selectAll(); } }); filterTxt.setOnItemClickListener((parent, view, position, id) -> { activity.onSelectedId(R.id.category, id); ToggleButton toggleBtn = (ToggleButton) filterTxt.getTag(); toggleBtn.performClick(); }); }
From source file:com.esri.squadleader.view.SquadLeaderActivity.java
private void setFollowMe(boolean isFollowMe) { ToggleButton followMeButton = (ToggleButton) findViewById(R.id.toggleButton_followMe); if (null != followMeButton) { if (isFollowMe != followMeButton.isChecked()) { followMeButton.performClick(); }//from w w w. ja v a2s. c o m } }