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

Update from getInteger to getInt #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deibeeed
Copy link

@deibeeed deibeeed commented Dec 5, 2017

Updated TypedArray.getInteger to TypedArray.getInt get porterduffxfermode

I don't know if this is experienced by someone but, in my end i'm able to experience a crash in my app because the library throws an UnsupportedOperationException

Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to integer: type=0x3

Updated `TypedArray.getInteger` to `TypedArray.getInt` go get `porterduffxfermode`
@deibeeed
Copy link
Author

deibeeed commented Dec 5, 2017

if you can merge this PR in the master branch and create a release for with this PR, it'll be a greate help for me and for those who will experience this in the future 😄

thanks by the way. this is a great library 👍

@christophesmet
Copy link
Owner

Mmh this is strange. The difference between TypeArray.getInt() and TypeArray.getInteger() is that the later will throw an exception if it cant parse it as an Int.
In this case the stacktrace reports type = 0x03, the String type.
For some reason, in your build the integers are represented as Strings.

Your pull request fixes this indeed, since the getInt function will fall back to a decode from string.
But that should never happen, I declared it as integers in the XML.

Am I missing something else that creates the original problem and adds it as strings your your app ?

Thanks

@deibeeed
Copy link
Author

deibeeed commented Dec 7, 2017

hmm.. I can't pinpoint the problem right now but my assumptions maybe there's a difference in reading styleable attrs in different version of android. especially that you didn't declare the format as integer
<attr name="porterduffxfermode">
so, the android OS assumes that your attr is string....
that's my assumption.. hope that helps:D

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

Successfully merging this pull request may close these issues.

2 participants