mathew-kurian / TextJustify-Android

:page_facing_up: Android Text Full Jusiftication / Wrapping / Justify / Hyphenate - V2.0
https://github.com/bluejamesbond/TextJustify-Android/wiki
Apache License 2.0
1.86k stars 370 forks source link

settext(char) in documentview cannot be applied to int boolean #124

Open sushantpaygude opened 7 years ago

sushantpaygude commented 7 years ago

I was able to use the DocumentView by passing a string from the Strings.xml file. I specified it in the ext:documentView_text attribute. However when I try to pass the file from Java code I am not able to do so.

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

This is the error when I try: DocumentView documentView = new DocumentView(this, DocumentView.PLAIN_TEXT); documentView.getDocumentLayoutParams().setTextAlignment(TextAlignment.JUSTIFIED); documentView.setText(mContext.getResources().getString(R.string.myString));

And when I try using: documentView.setText("Insert your text here", true);

It says:settext(char) in documentview cannot be applied to int boolean

Please Help :(