fragment button nullpointerexception code example
Example: fragment button nullpointerexception
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
View layout = inflater.inflate(R.layout.activity_warrior_self_battle_recyclerview, container, false);
recyclerView = (RecyclerView) layout.findViewById(R.id.recycler_view);
LinearLayoutManager layoutManager;
bStart = (Button) layout.findViewById(R.id.bOK);
nP1 = (EditText) layout.findViewById(R.id.nP1);
nP2 = (EditText) layout.findViewById(R.id.nP2);
bStart.setOnClickListener(this);
layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
recyclerView.setLayoutManager(layoutManager);
adapter = new WarriorBattleAdapter(getActivity());
recyclerView.setAdapter(adapter);
return layout;
}