Skip to content

Update from getInteger to getInt - #19

Open
deibeeed wants to merge 1 commit into
christophesmet:masterfrom
deibeeed:master
Open

Update from getInteger to getInt#19
deibeeed wants to merge 1 commit into
christophesmet:masterfrom
deibeeed:master

Conversation

@deibeeed

@deibeeed deibeeed commented Dec 5, 2017

Copy link
Copy Markdown

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

deibeeed commented Dec 5, 2017

Copy link
Copy Markdown
Author

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
Copy Markdown
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

deibeeed commented Dec 7, 2017

Copy link
Copy Markdown
Author

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