title: Java lang null pointer exception
body: <p>My following simple code shows no errors, 
  yet does not execute.
  FATAL EXCEPTION: main
  java.lang.RunTimeException: Unable to start activity.... 
  java.lang.NullPointerException.</p>
  
  <pre><code>package com.example.mapstestmednex;
  import android.app.Activity;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.os.Bundle;
  import android.view.Menu;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  
  private LocationManager lm;
  private LocationListener localListenD;
  public TextView tvLatitude;
  public TextView tvLongitude;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      lm = (LocationManager) getSystemService(LOCATION_SERVICE);
      Location loc = lm.getLastKnownLocation("gps");
  
      tvLatitude.setText(Double.toString(loc.getLatitude()));
      tvLongitude.setText(Double.toString(loc.getLatitude()));
  
      localListenD = new DipsListLocListener();
      lm.requestLocationUpdates("gps", 30000L, 10.0f, localListenD);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  class DipsListLocListener implements LocationListener {
  
      @Override
      public void onLocationChanged(Location location) {
          tvLatitude.setText(Double.toString(location.getLatitude()));
          tvLongitude.setText(Double.toString(location.getLatitude()));
      }
  
      @Override
      public void onProviderDisabled(String arg0) {
      }
  
      @Override
      public void onProviderEnabled(String arg0) {
      }
  
      @Override
      public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
      }
  
   }
  }
  </code></pre>
  
  <p>xml-file</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/LinearLayout1"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"
  tools:context=".MainActivity" &gt;
  
  &lt;TextView
      android:id="@+id/lblLatitude"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="Latitude:" /&gt;
  
  &lt;TextView
      android:id="@+id/tvLatitude"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" /&gt;
  
  &lt;TextView
      android:id="@+id/lblLongitude"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="Longitude:" /&gt;
  
  &lt;TextView
      android:id="@+id/tvLongitude"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>What's the problem?
  Thanks.</p>