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

New to android please help android.view.ContextThemeWrapper cannot be cast to android.app.Activity #31

Closed
tsviet opened this issue Apr 28, 2019 · 3 comments

Comments

@tsviet
Copy link

tsviet commented Apr 28, 2019

E/AndroidRuntime: FATAL EXCEPTION: Timer-0
Process: com.aliv.client, PID: 14012
java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity
at com.agrawalsuneet.dotsloader.loaders.LinearDotsLoader$scheduleTimer$1.run(LinearDotsLoader.kt:122)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

private fun scheduleTimer() {
timer = Timer()
timer?.scheduleAtFixedRate(object : TimerTask() {
override fun run() {
if (isSingleDir) {
selectedDotPos++
if (selectedDotPos > noOfDots) {
selectedDotPos = 1
}
} else {
if (isFwdDir) {
selectedDotPos++
if (selectedDotPos == noOfDots) {
isFwdDir = !isFwdDir
}
} else {
selectedDotPos--
if (selectedDotPos == 1) {
isFwdDir = !isFwdDir
}
}
}

            (context as Activity).runOnUiThread { invalidate() }
        }
    }, 0, animDur.toLong())
}
@agrawalsuneet
Copy link
Owner

@tsviet I have fixed the issue here #34
Will be releasing it soon.

@agrawalsuneet
Copy link
Owner

I have fixed the issue and released as v1.4.1
Let me know if this works for you or not and once it's verified, can you close this issue.

@akshaychavan7
Copy link

@agrawalsuneet Yes, the issue has been fixed in the new release. Thanks a lot!

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

No branches or pull requests

3 participants