Disabling the Seek bar progress in Android on condition via code
===

I have 3 seek bar in my application of android. I have used 3 variables used, remaining and total in application. I have to create the logic that progress of any seek bar is enabled only when used > 0 and maximum progress of any of the seek bar is value in the remaining variable.

My code is as follows:

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        sb1=(SeekBar) findViewById(R.id.seekBar1);
        sb2=(SeekBar) findViewById(R.id.seekBar2);
        sb3=(SeekBar) findViewById(R.id.seekBar3);
        
        tv1=(TextView) findViewById(R.id.textView1);
        tv2=(TextView) findViewById(R.id.textView2);
        tv3=(TextView) findViewById(R.id.textView3);
        
        sb1.setOnSeekBarChangeListener(this);
        sb2.setOnSeekBarChangeListener(this);
        sb3.setOnSeekBarChangeListener(this);
        
        total=100;
        used=0;
        remaining=total-used;
    }

	@Override
	public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) 
	{
		switch (arg0.getId()) 
		{
		case R.id.seekBar1:
			tv1.setText(Integer.toString(arg1));
			break;
		case R.id.seekBar2:
			tv2.setText(Integer.toString(arg1));
			break;
		case R.id.seekBar3:
			tv3.setText(Integer.toString(arg1));
			break;
		}
		used=used+arg1;
	}

	@Override
	public void onStartTrackingTouch(SeekBar arg0) 
	{
		if(used==0)
		{
			
		}
		
		// TODO Auto-generated method stub
		
	}

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

Help me how I achieve that. Thanxs in advance.