ToggleButton setChecked - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ToggleButton setChecked method.

This code example shows how to use the following methods:setVisibility, setChecked
		PassageChangeMediator.getInstance().forcePageUpdate(); 
	} 
 
	public void update() { 
        boolean showStrongsToggle = canShow();
        mButton.setVisibility(showStrongsToggle? View.VISIBLE : View.GONE);
        if (showStrongsToggle) {
	        boolean isShowstrongs = CommonUtils.getSharedPreferences().getBoolean("show_strongs_pref", true);
	        mButton.setChecked(isShowstrongs);
        } 
	} 
 
	/** return true if Strongs are relevant to this doc & screen */ 
	@Override 
	public boolean canShow() { 
		return isEnoughRoomInToolbar() && ControlFactory.getInstance().getDocumentControl().isStrongsInBook(); 
	} 
 
	@Override 
	public int getPriority() { 
6
CodeRank
This code example shows how to use the following methods:setVisibility, setOnCheckedChangeListener, setChecked
		  boolean enabled = getSharedPreferences().getBoolean(getKey()+"_y", false);
		  //Log.d("Preference", getTitle()+ "   enabled at start: "+enabled + "   y enabled: "+yEnabled); 
//		  if (yaxis != null) 
//			  enabled = yaxis.isChecked(); 
		  if (yEnabled)  {
			  yaxis.setChecked(enabled);
			  setBarState(!enabled);
			  yaxis.setOnCheckedChangeListener(this);
			  yaxis.setVisibility(View.VISIBLE);
		  } else { 
			  yaxis.setVisibility(View.INVISIBLE);
		  } 
 
		bar.setMax(maximum + minimum);
		bar.setProgress((int) this.oldValue);
		bar.setOnSeekBarChangeListener(this);
//		 
//		 
		setMonitorBox(bar.getProgress());
	} 
6
CodeRank
This code example shows how to use the following methods:setText, setChecked, setTextOff, setTextOn
		view = (ToggleButton) mInflater.inflate(AmlBuilder.localResources.getInt("aml_input_togglebutton"), null);
		Node label = n.getChildNodes().item(0);
		Node offTextNode = n.getAttributes().getNamedItem("offtext");
		Node onTextNode = n.getAttributes().getNamedItem("ontext");
		Node checkedNode = n.getAttributes().getNamedItem("checked");
		if (offTextNode != null) view.setTextOff(offTextNode.getNodeValue());
		if (onTextNode != null) view.setTextOn(onTextNode.getNodeValue());
		String checked = "";
		if (checkedNode != null) checked = checkedNode.getNodeValue().toLowerCase();
		if (label != null && label.getNodeValue().trim().length() > 0) view.setText(label.getNodeValue());
		else if (offTextNode != null && !checked.equals("yes")) view.setText(offTextNode.getNodeValue());
		else if (onTextNode != null && checked.equals("yes")) view.setText(onTextNode.getNodeValue());
		view.setChecked(checked.equals("yes"));
 		AmlBuilder.applyActionAttribute(view, "tap", n.getAttributes().getNamedItem("tap"));
		Log.d(TAG, "New ToggleButton input construction complete from XML node " + n.toString());
	} 
 
	/** 
	 * Get the View created from this object 
	 * @return View to be inserted into parent layout 
6
CodeRank
This code example shows how to use the following methods:setChecked, setTextOff, setTextOn
This code example shows how to use the following methods:setOnCheckedChangeListener, setChecked, setTextOff, setTextOn
		super.onCreate(savedInstanceState);
		 
		FrameLayout content = new FrameLayout(this);
		renderSurfaceView = new RenderSurfaceView(this);
		 
		toggle = new ToggleButton(this);
		toggle.setTextOn("Set Alpha");
        toggle.setTextOff("Set Rotate");
        toggle.setChecked(false);
		toggle.setOnCheckedChangeListener(new OnCheckedChangeListener() {
				 
			@Override 
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				mode = isChecked;
			} 
		}); 
		 
		// 500x500でViewを作成 
        content.addView(renderSurfaceView, new FrameLayout.LayoutParams(500, 500, Gravity.CENTER));
        content.addView(toggle, new FrameLayout.LayoutParams(200,200, Gravity.TOP));
6
CodeRank
This code example shows how to use the following methods:getTag, isChecked, setChecked
		return convertView;
	} 
	 
	public void onClick(View view) {
		ToggleButton btn = (ToggleButton) view;
		int msgWhat = (Integer) btn.getTag() * 2;
		msgWhat += btn.isChecked() ? 1 : 0;
		Message msg = new Message();
		msg.obj = btn;
		msg.what = msgWhat;
		// set checked after the confirm dialog 
		btn.setChecked(!btn.isChecked());
		statusToggleHandler.sendMessage(msg);
	} 
	 
	public static class ViewHolder { 
		public ToggleButton statusBtn;
		TextView aidText;
		TextView crText;
	} 
5
CodeRank
This code example shows how to use the following methods:isChecked, setOnCheckedChangeListener, setChecked
	/** 
	 * 	setupListeners 
	 */ 
	private void setupListeners() { 
		nameET.setOnEditorActionListener(this);
		lockTB.setOnCheckedChangeListener(this);
		saveButton.setOnClickListener(this);
	} 
 
	/** 
	 * 	setupWidets 
	 */ 
	private void setupWidgets() { 
		pageTitle.setText("Door");
		nameET.setText(door.getName());
		lockTB.setChecked(door.isLocked());
		pageTime.setText(DateFormat.getDateInstance().format(new Date()));
		leftButton.setVisibility(View.GONE);
		rightButton.setVisibility(View.GONE);
		 

5
CodeRank
This code example shows how to use the following methods:isChecked, setOnCheckedChangeListener, setChecked
	/** 
	 * 	setupListeners 
	 */ 
	private void setupListeners() { 
		nameET.setOnEditorActionListener(this);
		powerTB.setOnCheckedChangeListener(this);
		tempET.setOnEditorActionListener(this);
		saveButton.setOnClickListener(this);
	} 
 
	/** 
	 * 	setupWidets 
	 */ 
	private void setupWidgets() { 
		pageTitle.setText("Oven");
		nameET.setText(oven.getName());
		powerTB.setChecked(oven.isOn());
		tempET.setText(String.valueOf(oven.getTemp()));
		 
		pageTime.setText(DateFormat.getDateInstance().format(new Date()));

5
CodeRank
This code example shows how to use the following methods:setEnabled, setChecked
                mNumEnabledTimes++;
            } 
 
            if (BluetoothAdapter.STATE_OFF == newState) {
                mDisablingDialog.hide();
                mToggleButton.setEnabled(true);
            } 
 
            mToggleButton.setChecked(mBluetoothAdapter.isEnabled());
            getPassButton().setEnabled(mNumDisabledTimes > 0 &&  mNumEnabledTimes > 0);
        } 
    } 
 
    @Override 
    protected void onDestroy() { 
        super.onDestroy(); 
        unregisterReceiver(mReceiver);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getId, isChecked, setChecked
			else 
			{ 
				tb1.setChecked(true);
			} 
		} 
		else if (id==tb2.getId())
		{ 
			if (tb2.isChecked())
			{ 
				tb1.setChecked(false);
				tb3.setChecked(false);
			} 
			else 
			{ 
				tb2.setChecked(true);
			} 
		} 
		else 
		{ 
			if (tb3.isChecked())
5
CodeRank

Related ToggleButton setChecked Questions & Answers:

setChecked Method Overview
Changes the checked state of this button.
See Code Examples for other Android ToggleButton Methods: