Seekbar is used for the variable input like the volume or sound level or anything else like that. In this post I’m sharing the proper working code of that hope you will enjoyed it.
activity_main.xml
MAinActivity.java
import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.*; import android.widget.SeekBar.OnSeekBarChangeListener; public class MainActivity extends Activity implements OnSeekBarChangeListener { SeekBar s1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); s1=(SeekBar)findViewById(R.id.seekBar1); s1.setOnSeekBarChangeListener(this); } @Override public void onProgressChanged(SeekBar s1,int i1,boolean fromUSer) { Toast.makeText(getApplicationContext(),"SeekBar Progress:- "+i1,Toast.LENGTH_SHORT).show(); } @Override public void onStartTrackingTouch(SeekBar arg0) { Toast.makeText(getApplicationContext(),"SeekBar Started ",Toast.LENGTH_SHORT).show(); } @Override public void onStopTrackingTouch(SeekBar arg0) { Toast.makeText(getApplicationContext(),"SeekBar stoped",Toast.LENGTH_SHORT).show(); } }
The post Android Example of SeekBar appeared first on Junaid Shahid | P-Blogger.