Can you help me?
Thanks a lot...
This is my code:
Using java Syntax Highlighting
- import android.app.Activity;
- import android.content.Context;
- import android.location.Location;
- import android.location.LocationListener;
- import android.location.LocationManager;
- import android.os.Bundle;
- import android.widget.Toast;
- public class GPS3 extends Activity {
- public class GPS extends Activity
- {
- private LocationManager lm;
- private LocationListener locationListener;
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- //---use the LocationManager class to obtain GPS locations---
- lm = (LocationManager)
- getSystemService(Context.LOCATION_SERVICE);
- locationListener = new MyLocationListener();
- lm.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- 0,
- 0,
- locationListener);
- }
- private class MyLocationListener implements LocationListener
- {
- @Override
- public void onProviderDisabled(String provider) {
- // TODO Auto-generated method stub
- }
- @Override
- public void onProviderEnabled(String provider) {
- // TODO Auto-generated method stub
- }
- @Override
- public void onStatusChanged(String provider, int status,
- Bundle extras) {
- // TODO Auto-generated method stub
- }
- @Override
- public void onLocationChanged(Location location) {
- if (location != null) {
- Toast.makeText(getBaseContext(),
- "Location changed : Lat: " + location.getLatitude() +
- " Lng: " + location.getLongitude(),
- Toast.LENGTH_SHORT).show();
- }
- }
- }
- }
- }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4
Main Layout
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- </LinearLayout>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
Manifest
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.alex"
- android:versionCode="1"
- android:versionName="1.0.0">
- <application android:icon="@drawable/icon" android:label="@string/app_name">
- <activity android:name=".GPS3"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
- <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission>
- </manifest>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


