1. Download our Official Android App: Forums for Android!

LocationManager Help for app

Discussion in 'Android Apps & Games' started by AndroidWeather, Feb 21, 2011.

  1. AndroidWeather

    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Nov 10, 2010

    Nov 10, 2010
    4
    0
    5
    I am attempting to get latitude and longitude values into a URL in a android application anybody that can offer help would be my best friend :D


    I cant seem to figure out how to declare
    String Lon = new Double(loc.getLongitude()).toString();
    String Lat = new Double(loc.getLatitude()).toString();
    so that they work.

    Kind of a noob here but have tried all I can think of

    Code (Text):
    1. package comm.ca;
    2.  
    3. import comm.ca.R;
    4.  
    5. import android.app.Activity;
    6. import android.os.Bundle;
    7. import android.webkit.WebView;
    8. import android.location.LocationManager;
    9.  
    10.  
    11.  
    12. public class BrowserAct extends Activity {
    13.     @Override
    14.     public void onCreate(Bundle savedInstanceState) {
    15.         super.onCreate(savedInstanceState);
    16.         setContentView(R.layout.browser);
    17.         WebView mWebview = (WebView) findViewById(R.id.webview);
    18.         mWebview.getSettings().setJavaScriptEnabled(true);
    19.         String Lon = new Double(loc.getLongitude()).toString();
    20.         String Lat = new Double(loc.getLatitude()).toString();
    21.                 mWebview
    22.                 .loadUrl("example=" + Lat + "&textField2=" + Lon);
    23.     }
    24.    
    25.    
    26. }
     

    Advertisement

Share This Page

Loading...