Android Open Source - L-Switch-backport Test Activity






From Project

Back to project page L-Switch-backport.

License

The source code is released under:

Apache License

If you think the Android project L-Switch-backport listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package me.yugy.github.lswitchbackport.demo;
/*from w w w.j  a v  a  2s  .com*/
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.Toast;

import me.yugy.github.lswitchbackport.library.Switch;

public class TestActivity extends ActionBarActivity {

    private Switch mSwitch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

        mSwitch = (Switch) findViewById(R.id.switch_view);
        mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
                    Toast.makeText(TestActivity.this, "On", Toast.LENGTH_SHORT).show();
                }else{
                    Toast.makeText(TestActivity.this, "Off", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }

}




Java Source Code List

me.yugy.github.lswitchbackport.demo.TestActivity.java
me.yugy.github.lswitchbackport.library.Switch.java