Skip to content Skip to sidebar Skip to footer

Java.lang.nullpointerexception On Setonclicklistener In Fragment

I'm pretty new to Android and I'm trying to create an application that will score matches of the Vex Robotics Competition. I have a ViewPager with fragments for each team and i hav

Solution 1:

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

When it isn't

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

will be assigned null and

rAFloorGoalUp.setOnClickListener(...)

will raise a NullPointerException error.

Post a Comment for "Java.lang.nullpointerexception On Setonclicklistener In Fragment"