Buggy code:
public class WheelTrackingActivity extends Activity { public static String EXTRAS_DEVICE_CONTROL = "DEVICE_CONTROL" ; private static DecimalFormat mFormatter = new DecimalFormat ( "0.00" ) ; private static String mDegreeSymbol = "°" ; private TextView mLeftWheelDistanceTraveledTextView ; private double mLeftWheelDistanceTraveled ; private TextView mRightWheelDistanceTraveledTextView ; private double mRightWheelDistanceTraveled ; private TextView mHeadingTextView ; private float mHeading ; private EditText mWheelRadiusEditText ; private float mWheelRadius ; private EditText mAxleLengthEditText ; private float mAxleLength ; private Button mResetButton ; private Timer mTimer = new Timer ( ) ; private static final int TIME_CONSTANT = 30 ; private ArrayList < DeviceControl > mDevices = new ArrayList < DeviceControl > ( ) ; private WheelTracking mLeftWheel = null ; private WheelTracking mRightWheel = null ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; <START_BUG> setContentView ( activity_wheel_tracking ) ; <END_BUG> mDevices = DeviceControlActivity . mDevices ; mLeftWheel = mDevices . get ( 0 ) . getWheel ( ) ; if ( ( mDevices . size ( ) ) > 1 ) mRightWheel = mDevices . get ( 1 ) . getWheel ( ) ; mLeftWheelDistanceTraveledTextView = ( ( TextView ) ( findViewById ( left_wheel_distance_traveled ) ) ) ; mLeftWheelDistanceTraveled = Float . parseFloat ( mLeftWheelDistanceTraveledTextView . getText ( ) . toString ( ) ) ; mRightWheelDistanceTraveledTextView = ( ( TextView ) ( findViewById ( right_wheel_distance_traveled ) ) ) ; mRightWheelDistanceTraveled = Float . parseFloat ( mRightWheelDistanceTraveledTextView . getText ( ) . toString ( ) ) ; mHeadingTextView = ( ( TextView ) ( findViewById ( heading ) ) ) ; mHeading = Float . parseFloat ( mHeadingTextView . getText ( ) . toString ( ) ) ; mWheelRadiusEditText = ( ( EditText ) ( findViewById ( wheel_radius ) ) ) ; mWheelRadius = Float . parseFloat ( mWheelRadiusEditText . getText ( ) . toString ( ) ) ; mWheelRadiusEditText . addTextChangedListener ( new TextWatcher ( ) { @ Override public void onTextChanged ( CharSequence currentDigits , int start , int before , int count ) { mWheelRadius = Float . parseFloat ( currentDigits . toString ( ) ) ; } @ Override public void afterTextChanged ( Editable arg0 ) { } @ Override public void beforeTextChanged ( CharSequence arg0 , int arg1 , int arg2 , int arg3 ) { } } ) ; mAxleLengthEditText = ( ( EditText ) ( findViewById ( axle_length ) ) ) ; mAxleLength = Float . parseFloat ( mAxleLengthEditText . getText ( ) . toString ( ) ) ; mAxleLengthEditText . addTextChangedListener ( new TextWatcher ( ) { @ Override public void onTextChanged ( CharSequence currentDigits , int start , int before , int count ) { mAxleLength = Float . parseFloat ( currentDigits . toString ( ) ) ; } @ Override public void afterTextChanged ( Editable arg0 ) { } @ Override public void beforeTextChanged ( CharSequence arg0 , int arg1 , int arg2 , int arg3 ) { } } ) ; mResetButton = ( ( Button ) ( findViewById ( reset_button ) ) ) ; mResetButton . setOnClickListener ( new OnClickListener ( ) { @ Override public void onClick ( View arg0 ) { if ( ( mLeftWheel ) != null ) mLeftWheel . reset ( ) ; if ( ( mRightWheel ) != null ) mRightWheel . reset ( ) ; } } ) ; mTimer . scheduleAtFixedRate ( new WheelTrackingActivity . updateUI ( ) , 1000 , WheelTrackingActivity . TIME_CONSTANT ) ; } class updateUI extends TimerTask { public void run ( ) { } } private float findHeading ( ) { } @ Override protected void onPause ( ) { } @ Override public void onResume ( ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } }

Fix:
setContentView ( wheel_tracking_fragment ) ;