Search This Blog

Wednesday, July 13, 2016

Switch - Cách sử dụng Switch

// xử lý Switch
    switchBatTatThongBao.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if(isChecked){
            Toast.makeText(getApplicationContext(),"mở",Toast.LENGTH_SHORT).show();
        }else{
            Toast.makeText(getApplicationContext(),"tắt",Toast.LENGTH_SHORT).show();
        }
    }
});

No comments:

Post a Comment