Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Android Example of SeekBar

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.



This post first appeared on Junaid Shahid | P-Blogger, please read the originial post: here

Share the post

Android Example of SeekBar

×

Subscribe to Junaid Shahid | P-blogger

Get updates delivered right to your inbox!

Thank you for your subscription

×