Sponser

create your own banner at mybannermaker.com!

Tuesday, August 28, 2012

Seek Bar or Progress Bar or Slide Bar or Slider

This bar will be like this, the name for this bar is seek bar



In the xml file we need to mention like this to call the seek bar


xml

<SeekBar
android:id="@+id/seekbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10px"
/>


The java class file will be like this


Seek.java

package com.android.seek;

import android.app.Activity;
import android.media.AudioManager;
import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class Seek extends Activity {
/** Called when the activity is first created. */
AudioManager audioManager;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TextView reading = (TextView) findViewById(R.id.reading);
SeekBar seekBar = (SeekBar)findViewById(R.id.seekbar);
seekBar.setMax(100);
seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}

@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}

@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
reading.setText("Processing "+progress+"% ");
}
});
}
}



The code is fulling checked so you can run the code after downloading it itself.

You can download the full source code


Download source


Have a good day.

9 comments:

  1. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.
    Android developer| WINDOWS PHONE 7 DEVELOPMENT|

    ReplyDelete
  2. Thanks for such a nice tutorial.I want a customized seekbar in my application with images.Could you please help me with full detail like you have described the above example .


    Thanks

    Raam

    ReplyDelete
  3. Our Android Development comes to you cost effectively with assurance for quality and performance

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Awesome update.kindly update every information.thanks in advance............this is right one

      Website Design Company India | Website Design Service India

      Delete

Sponser