Hi in my android app I would like to hide the action bar on user interaction and show it again when the user has stopped interacting for some time. Now I already have the code for hiding the action bar:
mViewPager.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
getActionBar().hide();
return false;
}
});
I simply added an onTouchListener to my main view
But I do not know how to implement the getActionBar.show();
method. How do i find out whether the user has been not interacting for, let's say, 2 seconds and thus implement getActionBar().show();
?
Thanks in advance...
EDIT:
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
SystemClock.sleep(3000);
if (isCancelled()) {
break;
}
return null;
}
This code is giving an error. break can only be used inside loop or switch
. How to implement onCancelled()