This :
seekbar1.setOnSeekBarChangeListener( new OnSeekBarChangeListener(){
@Override
public void onProgressChanged(SeekBar arg0, int progress, boolean arg2) {
// TODO Auto-generated method stub
tv.setText("" + progress);
}
gets called when there is a change in the seek bar
and this:
String str = tv.getText().toString();
int number = Integer.parseInt(str);
if(number >= 0){
gets called immediately, regardless of whether there is a change in the seek bar or not,
hence, in order to ensure that the textview is not null
then in that case, set the seekbar position to 0 in the onCreate
right after you have initialized it.
Hope that helps.