Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context doesn't extend Activity #3

Closed
gkravas opened this issue Sep 28, 2016 · 2 comments
Closed

Context doesn't extend Activity #3

gkravas opened this issue Sep 28, 2016 · 2 comments

Comments

@gkravas
Copy link

gkravas commented Sep 28, 2016

On ViewTreeObserver.OnPreDrawListener.onPreDraw getContext() doesn't return an Activity but a ContextThemeWrapper. Activity extends ContextThemeWrapper. In my app I use only one activity and then handle fragments through back stack.

At line 194 View decor = ((Activity) getContext()).getWindow().getDecorView(); an exception is being thrown java.lang.ClassCastException: android.support.v7.view.ContextThemeWrapper cannot be cast to android.app.Activity.

It seems more appropriate to replace it with this View decor = ((Activity) ((ContextThemeWrapper) getContext()).getBaseContext()).getWindow().getDecorView();

@mmin18
Copy link
Owner

mmin18 commented Sep 28, 2016

Fixed in v1.0.4, can you check

@gkravas
Copy link
Author

gkravas commented Sep 28, 2016

Nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants