@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toggleSwitch = (Switch) findViewById(R.id.switchProcess); toggleSwitch.setChecked(o.findIfActive()); toggleSwitch.setOnCheckedChangeListener(this); etPhoneNumber = (EditText) findViewById(R.id.etPhoneNumber); o = new DecisionPointSMSOperations(getApplicationContext()); }
public void onCheckedChanged(CompoundButton compoundButton, boolean b) { String status = (b) ? "On" : "Off"; o.setActiveState(b); }