Increase / Decrease SeekBar progress with Button action?

0

Someone can help: How to increase and decrease seekBarHomem's progress through Button action?

@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);tv_QtdHomem=(TextView)findViewById(R.id.tv_QtdHomem);bt_MenosHomem=(Button)findViewById(R.id.bt_MenosHomem);bt_MaisHomem=(Button)findViewById(R.id.bt_MaisHomem);seekBarHomem=(SeekBar)findViewById(R.id.seekBarHomem);seekBarHomem.setOnSeekBarChangeListener(newSeekBar.OnSeekBarChangeListener(){@OverridepublicvoidonProgressChanged(SeekBarseekBar,inti,booleanb){tv_QtdHomem.setText(""+i);

        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });

    bt_MaisHomem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {


        }
    });

   bt_MenosHomem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {


        }
    });
}

}

    
asked by anonymous 22.09.2017 / 07:32

1 answer

3

Just use the methods setProgress and getProgress of SeekBar :

bt_MaisHomem.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        seekBarHomem.setProgress(seekBarHomem.getProgress() + 1)
    }
});
    
22.09.2017 / 12:29