android – java.lang.NullPointerException on setOnClickListener in Fragment

android – java.lang.NullPointerException on setOnClickListener in Fragment

Open your fragment_blue.xml layout. Your Button with id rAFloorGoalUp needs to be declared in this file.

When it isnt

Button rAFloorGoalUp = (Button) rootView.findViewById(R.id.rAFloorGoalUp);

will be assigned null and

rAFloorGoalUp.setOnClickListener(...)

will raise a NullPointerException error.

android – java.lang.NullPointerException on setOnClickListener in Fragment

Leave a Reply

Your email address will not be published. Required fields are marked *