mathew-kurian/TextJustify-Android

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

Opened this issue · 0 comments

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 :(