ChatFragment.java:
public class ChatFragment extends Fragment {
private FirebaseListAdapter<ChatMessage> adapter;
View RootView;
EmojiconEditText emojiconEditText;
ImageView emojiButton,submitButton;
EmojIconActions emojIconActions;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View RootView = inflater.inflate(R.layout.fragment_chat,container,false);
this.RootView = RootView;
return RootView;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//:55
emojiButton = (ImageView)this.RootView.findViewById(R.id.emoji_button);
submitButton = (ImageView)this.RootView.findViewById(R.id.submit_button);
emojiconEditText = (EmojiconEditText)this.RootView.findViewById(R.id.emojicon_edit_text);
emojIconActions = new EmojIconActions(getActivity().getApplicationContext(),this.RootView,emojiButton,emojiconEditText);
emojIconActions.ShowEmojicon();
错误:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
at dev.edmt.chatapp.ChatFragment.onCreate(ChatFragment.java:55)
//:60
emojIconActions = new EmojIconActions(getActivity().getApplicationContext(),this.RootView,this.emojiButton,this.emojiconEditText);
emojIconActions.ShowEmojicon();
错误:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void hani.momanii.supernova_emoji_library.Helper.EmojiconEditText.setOnFocusChangeListener(android.view.View$OnFocusChangeListener)' on a null object reference
at hani.momanii.supernova_emoji_library.Actions.EmojIconActions.setFocusListener(EmojIconActions.java:241)
at hani.momanii.supernova_emoji_library.Actions.EmojIconActions.<init>(EmojIconActions.java:64)
at dev.edmt.chatapp.ChatFragment.onCreate(ChatFragment.java:60)
天涯尽头无女友
相关分类