Android谷歌地图:膨胀类片段时出错

Android谷歌地图:膨胀类片段时出错,android,eclipse,google-maps,google-maps-android-api-2,Android,Eclipse,Google Maps,Google Maps Android Api 2,我对安卓系统的开发非常陌生,有时我会尝试在我的应用程序中添加一个地图。我尝试了一些事情,但没有成功。如果有人能帮助我,我将不胜感激 我做过的事情: 将google-play-services_库添加到我的软件包浏览器中 包括android-support-v4.jar和google-play-services.jar作为我项目的依赖项 我试过几个建议,但谷歌地图API v2 Android不起作用 运行我的项目时,出现以下错误: 06-15 20:31:37.666: E/AndroidRu

我对安卓系统的开发非常陌生,有时我会尝试在我的应用程序中添加一个地图。我尝试了一些事情,但没有成功。如果有人能帮助我,我将不胜感激

我做过的事情:

  • 将google-play-services_库添加到我的软件包浏览器中
  • 包括android-support-v4.jar和google-play-services.jar作为我项目的依赖项
我试过几个建议,但谷歌地图API v2 Android不起作用

运行我的项目时,出现以下错误:

06-15 20:31:37.666: E/AndroidRuntime(15687): FATAL EXCEPTION: main 06-15 20:31:37.666: E/AndroidRuntime(15687): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hellomap/com.example.hellomap.MainActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class fragment 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.ActivityThread.access$700(ActivityThread.java:134) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.os.Handler.dispatchMessage(Handler.java:99) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.os.Looper.loop(Looper.java:137) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.ActivityThread.main(ActivityThread.java:4867) 06-15 20:31:37.666: E/AndroidRuntime(15687): at java.lang.reflect.Method.invokeNative(Native Method) 06-15 20:31:37.666: E/AndroidRuntime(15687): at java.lang.reflect.Method.invoke(Method.java:511) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) 06-15 20:31:37.666: E/AndroidRuntime(15687): at dalvik.system.NativeStart.main(Native Method) 06-15 20:31:37.666: E/AndroidRuntime(15687): Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class fragment 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.view.LayoutInflater.inflate(LayoutInflater.java:466) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.Activity.setContentView(Activity.java:1901) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.example.hellomap.MainActivity.onCreate(MainActivity.java:14) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.Activity.performCreate(Activity.java:5047) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056) 06-15 20:31:37.666: E/AndroidRuntime(15687): ... 11 more 06-15 20:31:37.666: E/AndroidRuntime(15687): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 but found 0. You must have the following declaration within the element: 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.maps.internal.q.B(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.maps.internal.q.A(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.maps.SupportMapFragment$b.gW(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.dynamic.a.a(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.dynamic.a.onInflate(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:290) 06-15 20:31:37.666: E/AndroidRuntime(15687): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676) 06-15 20:31:37.666: E/AndroidRuntime(15687): ... 20 more
坦克的

试试我的其他帖子。我已经详细解释了地图的工作原理

你现在应该可以使用地图了

以下是我正在使用的地图的布局片段:

<fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        class="com.google.android.gms.maps.SupportMapFragment" />
编辑:

如果对前面的答案有疑问,代码如下:

1)在MainActivity中,扩展片段Activity并实现LocationListener, OnMapClickListener、OnMapLongClickListener如下所示:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mike.mylocation"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <permission
        android:name="com.mike.maps.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.mapsexample.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.mike.mylocation.HomeActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="YOUE API WILL GO HERE" />
    </application>

</manifest>
public class MainActivity extends FragmentActivity implements LocationListener,
        OnMapClickListener, OnMapLongClickListener {

private static final int GPS_ERRORDIALOG_REQUEST = 9001;

    GoogleMap map;
    List<Address> matches;
    String addressText;
    String addressLine;
    double latitude;
    double longitude;
    AppUtils mAppUtils;
    Context context;
    LocationManager locationManager;

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = this;

        if (servicesOK()) {
            // Toast.makeText(this, "Ready to map!!", Toast.LENGTH_LONG).show();
            setContentView(R.layout.activity_main);

            // Getting reference to the SupportMapFragment of activity_main.xml
            SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.map);

            // Getting GoogleMap object from the fragment
            map = fm.getMap();

            // Enabling MyLocation Layer of Google Map
            map.setMyLocationEnabled(true);

            // Getting LocationManager object from System Service
            // LOCATION_SERVICE
            locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

            // Creating a criteria object to retrieve provider
            Criteria criteria = new Criteria();

            // Getting the name of the best provider
            String provider = locationManager.getBestProvider(criteria, true);

            // Getting Current Location
            Location location = locationManager.getLastKnownLocation(provider);

            if (location != null) {
                onLocationChanged(location);
            }
            locationManager.requestLocationUpdates(provider, 20000, 0, this);

        } else {
            setContentView(R.layout.activity_main);

        }

    }

@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
    }

        //This is the main stuff here. This is when the location is changed.
        @Override
    public void onLocationChanged(Location location) {

        // Getting latitude of the current location
        latitude = location.getLatitude();

        // Getting longitude of the current location
        longitude = location.getLongitude();

        // Creating a LatLng object for the current location
        LatLng latLng = new LatLng(latitude, longitude);

        // Showing the current location in Google Map
        map.moveCamera(CameraUpdateFactory.newLatLng(latLng));

        // Zoom in the Google Map
        map.animateCamera(CameraUpdateFactory.zoomTo(12));

        map.addMarker(
                new MarkerOptions().position(new LatLng(latitude, longitude))
                        .title("My Location" + "\n")).showInfoWindow();

        map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {

            @Override
            public boolean onMarkerClick(Marker marker) {

                marker.showInfoWindow();

                return false;
            }

        });


            //This is optional........................................................
        Geocoder geoCoder = new Geocoder(this);

        try {
            matches = geoCoder.getFromLocation(latitude, longitude, 1);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Address bestMatch = (matches.isEmpty() ? null : matches.get(0));
        addressText = String.format("%s, %s, %s", bestMatch
                .getMaxAddressLineIndex() > 0 ? bestMatch.getAddressLine(0)
                : "", bestMatch.getLocality(), bestMatch.getCountryName());
          //...........................................................................


    }

    @Override
    public void onMapLongClick(LatLng point) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onMapClick(LatLng point) {
        // TODO Auto-generated method stub

    }

//Check if the service is OK

public boolean servicesOK() {

        int isAvailable = GooglePlayServicesUtil
                .isGooglePlayServicesAvailable(this);

        if (isAvailable == ConnectionResult.SUCCESS) {

            return true;

        } else if (GooglePlayServicesUtil.isUserRecoverableError(isAvailable)) {

            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(isAvailable,
                    this, GPS_ERRORDIALOG_REQUEST);
            dialog.show();

        } else {

            Toast.makeText(this, "Cant connect!!", Toast.LENGTH_SHORT).show();

        }
        return false;
    }

    @Override
    protected void onPause() {

        super.onPause();
        locationManager.removeUpdates(this);

    }


    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        locationManager.removeUpdates(this);
    }


    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
                1, this);
    }
public类MainActivity扩展FragmentActivity实现LocationListener,
OnMapClickListener,OnMapLongClickListener{
私人静态最终内部GPS错误对话框请求=9001;
谷歌地图;
列出匹配项;
字符串地址文本;
字符串地址行;
双纬度;
双经度;
附属物;
语境;
地点经理地点经理;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
上下文=这个;
if(servicesOK()){
//Toast.makeText(这是“准备映射!!”,Toast.LENGTH_LONG.show();
setContentView(R.layout.activity_main);
//获取对activity_main.xml的SupportMapFragment的引用
SupportMapFragment fm=(SupportMapFragment)getSupportFragmentManager()
.findFragmentById(R.id.map);
//从片段中获取GoogleMap对象
map=fm.getMap();
//启用Google地图的MyLocation层
map.setMyLocationEnabled(true);
//从系统服务获取LocationManager对象
//地点服务
locationManager=(locationManager)getSystemService(位置服务);
//创建条件对象以检索提供程序
标准=新标准();
//获取最佳提供商的名称
字符串提供程序=locationManager.getBestProvider(条件为true);
//获取当前位置
Location Location=locationManager.getLastKnownLocation(提供者);
如果(位置!=null){
onLocationChanged(位置);
}
locationManager.RequestLocationUpdate(提供程序,20000,0,此);
}否则{
setContentView(R.layout.activity_main);
}
}
@凌驾
公共无效onProviderDisabled(字符串提供程序){
//TODO自动生成的方法存根
}
@凌驾
公共无效onProviderEnabled(字符串提供程序){
//TODO自动生成的方法存根
}
@凌驾
public void onStatusChanged(字符串提供程序、int状态、Bundle extra){
//TODO自动生成的方法存根
}
//这是这里的主要内容。这是位置改变的时候。
@凌驾
已更改位置上的公共无效(位置){
//正在获取当前位置的纬度
纬度=位置。getLatitude();
//正在获取当前位置的经度
longitude=location.getLongitude();
//为当前位置创建LatLng对象
LatLng LatLng=新LatLng(纬度、经度);
//在谷歌地图中显示当前位置
地图移动摄像机(CameraUpdateFactory.newLatLng(latLng));
//放大谷歌地图
map.animateCamera(CameraUpdateFactory.zoomTo(12));
map.addMarker(
新标记选项().位置(新板条(纬度、经度))
.title(“我的位置”+“\n”)).showInfoWindow();
setOnMarkerClickListener(新的GoogleMap.OnMarkerClickListener(){
@凌驾
公共布尔onMarkerClick(标记){
marker.showInfoWindow();
返回false;
}
});
//这是可选的。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
Geocoder Geocoder=新的Geocoder(本);
试一试{
matches=geoCoder.getFromLocation(纬度,经度,1);
}捕获(IOE异常){
//TODO自动生成的捕捉块
e、 printStackTrace();
}
地址bestMatch=(matches.isEmpty()?null:matches.get(0));
addressText=String.format(“%s,%s,%s”,最佳匹配
.getMaxAddressLineIndex()>0?最佳匹配.getAddressLine(0)
:“”,bestMatch.getLocality(),bestMatch.getCountryName());
//...........................................................................
}
@凌驾
在马普隆喀喇克(LatLng点)上的公共空隙{
//TODO自动生成的方法存根
}
@凌驾
公共空区(停车点){
//TODO自动生成的方法存根
}
//检查服务是否正常
公共布尔服务sok(){
int isAvailable=GooglePlayServicesUtil
.isGooglePlayServicesAvailable(此);
if(isAvailable==ConnectionResult.SUCCESS){
返回true;
}else if(GooglePlayServicesUtil.isUserRecoverableError(isAvailable)){
Dialog Dialog=GooglePlayServicesUtil.getErrorDialog(可用,
这是GPS错误对话框(请求);
dialog.show();
}否则{
Toast.makeText(这个“无法连接!!”,Toast.LENGTH\u SHORT.show();
}
返回fa
<fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        class="com.google.android.gms.maps.SupportMapFragment" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mike.mylocation"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <permission
        android:name="com.mike.maps.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.mapsexample.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.mike.mylocation.HomeActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="YOUE API WILL GO HERE" />
    </application>

</manifest>
    @Override
    protected void onPause() {

        super.onPause();
        locationManager.removeUpdates(this);

    }


    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        locationManager.removeUpdates(this);
    }


    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
                1, this);
    }
public class MainActivity extends FragmentActivity implements LocationListener,
        OnMapClickListener, OnMapLongClickListener {

private static final int GPS_ERRORDIALOG_REQUEST = 9001;

    GoogleMap map;
    List<Address> matches;
    String addressText;
    String addressLine;
    double latitude;
    double longitude;
    AppUtils mAppUtils;
    Context context;
    LocationManager locationManager;

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = this;

        if (servicesOK()) {
            // Toast.makeText(this, "Ready to map!!", Toast.LENGTH_LONG).show();
            setContentView(R.layout.activity_main);

            // Getting reference to the SupportMapFragment of activity_main.xml
            SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.map);

            // Getting GoogleMap object from the fragment
            map = fm.getMap();

            // Enabling MyLocation Layer of Google Map
            map.setMyLocationEnabled(true);

            // Getting LocationManager object from System Service
            // LOCATION_SERVICE
            locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

            // Creating a criteria object to retrieve provider
            Criteria criteria = new Criteria();

            // Getting the name of the best provider
            String provider = locationManager.getBestProvider(criteria, true);

            // Getting Current Location
            Location location = locationManager.getLastKnownLocation(provider);

            if (location != null) {
                onLocationChanged(location);
            }
            locationManager.requestLocationUpdates(provider, 20000, 0, this);

        } else {
            setContentView(R.layout.activity_main);

        }

    }

@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
    }

        //This is the main stuff here. This is when the location is changed.
        @Override
    public void onLocationChanged(Location location) {

        // Getting latitude of the current location
        latitude = location.getLatitude();

        // Getting longitude of the current location
        longitude = location.getLongitude();

        // Creating a LatLng object for the current location
        LatLng latLng = new LatLng(latitude, longitude);

        // Showing the current location in Google Map
        map.moveCamera(CameraUpdateFactory.newLatLng(latLng));

        // Zoom in the Google Map
        map.animateCamera(CameraUpdateFactory.zoomTo(12));

        map.addMarker(
                new MarkerOptions().position(new LatLng(latitude, longitude))
                        .title("My Location" + "\n")).showInfoWindow();

        map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {

            @Override
            public boolean onMarkerClick(Marker marker) {

                marker.showInfoWindow();

                return false;
            }

        });


            //This is optional........................................................
        Geocoder geoCoder = new Geocoder(this);

        try {
            matches = geoCoder.getFromLocation(latitude, longitude, 1);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Address bestMatch = (matches.isEmpty() ? null : matches.get(0));
        addressText = String.format("%s, %s, %s", bestMatch
                .getMaxAddressLineIndex() > 0 ? bestMatch.getAddressLine(0)
                : "", bestMatch.getLocality(), bestMatch.getCountryName());
          //...........................................................................


    }

    @Override
    public void onMapLongClick(LatLng point) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onMapClick(LatLng point) {
        // TODO Auto-generated method stub

    }

//Check if the service is OK

public boolean servicesOK() {

        int isAvailable = GooglePlayServicesUtil
                .isGooglePlayServicesAvailable(this);

        if (isAvailable == ConnectionResult.SUCCESS) {

            return true;

        } else if (GooglePlayServicesUtil.isUserRecoverableError(isAvailable)) {

            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(isAvailable,
                    this, GPS_ERRORDIALOG_REQUEST);
            dialog.show();

        } else {

            Toast.makeText(this, "Cant connect!!", Toast.LENGTH_SHORT).show();

        }
        return false;
    }

    @Override
    protected void onPause() {

        super.onPause();
        locationManager.removeUpdates(this);

    }


    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        locationManager.removeUpdates(this);
    }


    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
                1, this);
    }