Android For Freshers
Android Seekbar Example
Java Code(SeekAct)
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
public class SeekAct extends Activity {
SeekBar sb;
TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_seek);
tv = (TextView)findViewById(R.id.tv1);
sb = (SeekBar)findViewById(R.id.sb1);
sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
tv.setText(“”+progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar){
}
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
});
}
public void view1(View v)
{
Intent i=new Intent(SeekAct.this,SeekNext.class);
startActivity(i);
}
}
Layout XML Code(activity_seek)
<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:tools=”http://schemas.android.com/tools”
android:layout_width=”match_parent”
android:orientation=”vertical”
android:layout_height=”match_parent”
android:paddingBottom=”@dimen/activity_vertical_margin”
android:paddingLeft=”@dimen/activity_horizontal_margin”
android:paddingRight=”@dimen/activity_horizontal_margin”
android:paddingTop=”@dimen/activity_vertical_margin”
tools:context=”com.andro.tech.androidproject.SeekAct”>
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textSize=”@dimen/textsize”
android:layout_gravity=”center”
android:textStyle=”bold”
android:text=”SEEK BAR”
android:layout_marginBottom=”80dp” />
<SeekBar
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:id=”@+id/sb1″
android:layout_marginBottom=”50dp”/>
<TextView
android:textSize=”30sp”
android:textColor=”#123″
android:textStyle=”bold”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=” “
android:id=”@+id/tv1″
android:layout_gravity=”center”
android:layout_marginTop=”30dp”
android:layout_below=”@+id/sb2″
android:layout_centerHorizontal=”true”
android:layout_marginBottom=”120dp”/>
<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/sourcecode”
android:background=”@color/bgcolor”
android:textStyle=”bold”
android:textColor=”@color/text”
android:onClick=”view1″/>
</LinearLayout>
Output
Android Seek Bar code example Download
For More Android Programs –Click Here
Follow Us – Never Miss Update
Fb/Page, Twitter, Google+, Instagram, Pinterest
Related Search
Android seek bar action code download, android seek bar snippet code download, android seek bar snippet source code, android seek bar code download, android seek example with source code, android seek c\bar action example code, android seek bar code example download, Android Seek bar code example