Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swVolume.setChecked(true);
- swVolume.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- }
- });
- if(swVolume.isChecked()){
- AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
- am.setStreamVolume(
- AudioManager.STREAM_RING,
- am.getStreamMaxVolume(AudioManager.STREAM_RING),
- 0);
- }
- else {
- swVolume.setChecked(false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement