import android.app.Activity;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
public class Ex03_18Activity extends Activity {
Switch switcher;
TextView txtResult;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtResult = (TextView)findViewById(R.id.txtResult);
switcher = (Switch)findViewById(R.id.switchSound);
switcher.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if( isChecked ){
txtResult.setText("ON~");
}else{
txtResult.setText("OFF~");
}
}
});
}
}
'Dev_Android > Widget' 카테고리의 다른 글
internet과 android연결 (0) | 2013.10.29 |
---|---|
findViewById (0) | 2013.10.29 |
Sipnner (0) | 2013.10.29 |