Q:

How to let Fragment do some action before onBackPressed() kill it

I wonder if this is possible to do in AppCompatActivity. I want to let top most Fragment do some action before AppCompatActivity super.onBackPressed(); kill Fragment
Here´s the mockup code which speaks for itself:
 @Override
public void onBackPressed() {
  ToppMosteFragment.doSomeActionBeforeBackPressedKillYou();
  final Handler handler = new Handler();
  handler.postDelayed(new Runnable() {
        @Override
        public void run() {
           // this is not working..
           super.onBackPressed();
        }
  }, 1000);
}

A:

You can try to make doSomeActionBeforeBackPressedKillYou() return a boolean
and do 
 @Override
public void onBackPressed() {
  if(ToppMosteFragment.doSomeActionBeforeBackPressedKillYou()) {
      super.onBackPressed();
  }
}

EDIT:
If you defined the animation , you can add a listener  :
    Animation animation = actionButton.getHideAnimation();

    animation.setAnimationListener(new Animation.AnimationListener(){
        @Override
        public void onAnimationStart(Animation arg0) {
        }           
        @Override
        public void onAnimationRepeat(Animation arg0) {
        }           
        @Override
        public void onAnimationEnd(Animation arg0) {
            listener.onFabAnimationEnd();
        }
    });

    actionButton.setHideAnimation(animation);

listener is a interface that is implement by your activity class
And in you activity 
@Override
public void onFabAnimationEnd() {
    super.onBackPressed();
}

