title: Android onSaveInstanceState and/or onRestoreInstanceState crashing
body: <p>I am relatively new to programming for Android and I'm stuck on a (probably simple) issue. I've tried hours worth of messing around but getting nowhere...</p>
  
  <p>My code is as follows, it stops the app when the device is rotated and the activity is restarted. I have used the  onSaveInstanceState and onRestoreInstanceState methods but they aren't helping me! Could someone take a look please:</p>
  
  <pre><code>public class DebugActivity extends Activity implements GPSCallback{
  private GPSManager gpsM=null;
  private ConvertSpeed conS =null;
  private double speed = 0.0;
  
      @Override
      public void onCreate(Bundle savedInstanceState){
          if(savedInstanceState != null){
              speed = savedInstanceState.getDouble("speed");
          }
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_debug);
          gpsM = new GPSManager();
          gpsM.startListening(getApplicationContext());
          gpsM.setGPSCallback(this);
          conS = new ConvertSpeed();
      }
      @Override
      public void onSaveInstanceState(Bundle outState){
          outState.putDouble("speed",speed);
          super.onSaveInstanceState(outState);
      }
      @Override
      public void onRestoreInstanceState(Bundle savedInstanceState){
          super.onRestoreInstanceState(savedInstanceState);
          speed = savedInstanceState.getDouble("speed");
      }
  @Override
      public void onDestroy(){
          gpsM.stopListening();
          gpsM.setGPSCallback(null);
          gpsM = null;
      }
      @Override
      public void onGPSUpdate(Location location) {
          location.getLatitude();
          location.getLongitude();
          speed = location.getSpeed();
          String speedString = "" + conS.convertSpeed(speed,2);
          TextView debug1 = ((TextView)findViewById(R.id.tvSpeed));
          debug1.setText(speedString);
      }
  }
  </code></pre>
  
  <p>Debugging:</p>
  
  <p>In the <code>onCreate</code> method, the first time the Activity Runs:</p>
  
  <pre><code>if(savedInstanceState != null){
  speed = savedInstanceState.getDouble("speed");
  </code></pre>
  
  <p>it shows <code>outState = null</code> and <code>speed = 0.0</code></p>
  
  <p>The screen rotates, the <code>onSaveInstanceState</code> method shows <code>outState = Bundle[{speed=0.0}]</code>, then 2 seconds later it crashes without reaching <code>onRestoreInstanceState</code> or <code>onCreate</code> again</p>