when button click to activated mouse scroll in android <p>After button click to mouse scroll to be activted,then scroll up to value increment and scroll down to value decrement.Button inside code here not working, my sample code here,please analysis code to help me.</p> <pre><code>enter code here public class MainActivity extends Activity { Button button; int x,f; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button=(Button)findViewById(R.id.button1); button.setOnTouchListener(new OnTouchListener() { @SuppressLint("NewApi") @Override public boolean onTouch(View arg0, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: if (event.getAxisValue(MotionEvent.AXIS_VSCROLL) &lt; 0.0f) //selectNext(); { x=Integer.parseInt(button.getText().toString()); f=x+5; button.setText(""+f); } else { x=Integer.parseInt(button.getText().toString()); f=x-5; button.setText(""+f); return true; } } return false; } }); </code></pre> <p>} </p>