How to put value from getLongitude or getLatitude() intto EditText?
<p>how to convert value from getLongitude() and getLatitude() to format that can be accepted by the EditText?</p>

<p>it works if i put them into Toast like this</p>

<pre><code>String message = "Current Location \nLongitude: "+location.getLongitude()+"\nLatitude: "+location.getLatitude();
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
</code></pre>

<p>but if i put them into EditText like this, the application will stopped and error</p>

<pre><code>tv_obj_long.setText(location.getLongitude());
tv_obj_lat.setText(location.getLatitude());
</code></pre>

<p>i think the format is wrong, i'm trying with Double.toString() but it still error</p>

<p>how to fix this?</p>

<p>thanks</p>

<p>this is my code on the button</p>

<pre><code>btn_obj_useKor.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View arg0) {
      showCurrentLocation();
   }
});
</code></pre>

<p>this is the function called by the button</p>

<pre><code>public void showCurrentLocation() {
        Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if (location != null) {
                showToastStatus(location);
                tv_obj_long.setText(String.valueOf(location.getLongitude()));
                tv_obj_lat.setText(String.valueOf(location.getLatitude()));
            }else{
                Toast.makeText(getApplicationContext(), "Terjadi Kesalahan dalam pengambilan koordinat", Toast.LENGTH_LONG).show();
        }
    };
</code></pre>

<p>this is the toast that works</p>

<pre><code>public void showToastStatus(Location location){
        String message = "Current Location \nLongitude: "+location.getLongitude()+"\nLatitude: "+location.getLatitude();
        Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
    }
</code></pre>

<p>and this is my xml</p>

<pre><code>&lt;TextView
        android:text="Longitude"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/&gt;
      &lt;EditText
        android:id="@+id/tv_obj_long"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/&gt;
      &lt;TextView
        android:text="Latitude"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/&gt;
      &lt;EditText
        android:id="@+id/tv_obj_lat"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/&gt;
</code></pre>

<p>help me guys -<em>_</em>-</p>
