title: How to convert lat lng to a Location variable?
body: <p>I am making a map app in android, I want to get 2 locations on the map, and see the distance between them. I already got my current location as a "Location" variable. The other place however is saved as two variables : double lat,lng;</p>
  
  <p>I have checked the internet and found this method that will help : </p>
  
  <pre><code>float distance = myLocation.distanceTo(temp);
  </code></pre>
  
  <p>The problem is that the "temp" I have is not a "Location", it is 2 different doubles.</p>
  
  <p>Is there a way to convert them to Location?</p>
  
  <p>PS. Code i tried but did't work : </p>
  
  <pre><code>Location temp = null;
  temp.setLatitude(23.5678);
  temp.setLongitude(34.456);
  float distance = location.distanceTo(temp);
  </code></pre>
  
  <p>Problem : </p>
  
  <blockquote>
    <p>Null pointer access: The variable temp can only be null at this location</p>
  </blockquote>