0

I use the code from https://github.com/Dreddik/AndroidTouchGallery to implement pinch zoom for imageView. It works great. But now I want to call getActionBar.show() and hide() inside the touchEvent of TouchImageView class.

The problem is this class extends ImageView so I cannot call getActionBar().

Any advice?

Casper
  • 1,663
  • 7
  • 35
  • 62
  • 1
    `super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); getActionBar().hide(); setContentView(R.layout.splash);`http://stackoverflow.com/questions/8500283/how-to-hide-action-bar-before-activity-is-created-and-then-show-it-again – Alexander.Iljushkin Nov 07 '13 at 06:08

1 Answers1

4

It may help you...

public static class TouchView extends ImageView {

    public TouchView(Context context) {
        super(context);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Activity activity = (Activity) getContext();
        ActionBar actionBar = activity.getActionBar();
        actionBar.show();
        return super.onTouchEvent(event);
    }
}
Gopal Gopi
  • 11,101
  • 1
  • 30
  • 43