Hello. I save a String from AXEmojiEditText to storage when I close the fragment. When I open this fragment again, I take the value from the database and set the text to AXEmojiEditText. The error occurs when emoji are present in the saved text. The error doesn't happen every time. I initialize emojiView before the method restoreDraft. Please help me solve this problem.
private fun restoreDraft() {
val draft = viewModel.getChat(getParams().id)?.draftMessage
if (draft != null) `binding.chatInput.setText(draft)
}
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.regex.Matcher java.util.regex.Pattern.matcher(java.lang.CharSequence)' on a null object reference
Hello. I save a String from AXEmojiEditText to storage when I close the fragment. When I open this fragment again, I take the value from the database and set the text to AXEmojiEditText. The error occurs when emoji are present in the saved text. The error doesn't happen every time. I initialize emojiView before the method restoreDraft. Please help me solve this problem.
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.regex.Matcher java.util.regex.Pattern.matcher(java.lang.CharSequence)' on a null object reference