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

setBackgroundResource(Drawable) can't accept a selector or shape xml as the parameter? #201

Open
pwcat opened this issue Jan 12, 2019 · 1 comment

Comments

@pwcat
Copy link

pwcat commented Jan 12, 2019

For example, a selector file like this:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http:https://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/et_focused_background" android:state_focused="true"/> <item android:drawable="@drawable/et_unfocus_background" android:state_focused="false"/> </selector>

pass it into the method : editor.setBackgroundResource(R.drawable.post_et_selector)
cause crash:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
at jp.wasabeef.richeditor.Utils.toBase64(Utils.java:36)
at jp.wasabeef.richeditor.RichEditor.setBackgroundResource(RichEditor.java:226)

@pwcat
Copy link
Author

pwcat commented Jan 12, 2019

well, just saw the source codes and understood why. I might need to find another way.

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

1 participant