Posts

Showing posts with the label AudioManager in Sketchware

Control device media volume using Seekbar in Sketchware App

Image
The Seekbar can be set to control media volume of device, when any media is playing, with the use of simple codes in add source directly block in Sketchware. In your Sketchware project, in   VIEW area add a TextView ( textview1 ) and a SeekBar ( seekbar1 ). Set the progress of Seekbar to 12. In LOGIC area, in onCreate event add following code in end using add source directly block: audioManager = (AudioManager) getSystemService(Context. AUDIO_SERVICE); seekbar1.setMax(audioManager. getStreamMaxVolume( AudioManager.STREAM_MUSIC)); Create a More block and put following code in it using an add source directly block. } AudioManager audioManager; private void nothing() { In Seekbar onProgressChanged event add following code using add source directly block: textview1.setText("Music Volume : " + _progressValue); audioManager.setStreamVolume( AudioManager.STREAM_MUSIC, _progressValue, 0); That's all. Save and run the project. You sh...