locationmanager.requestForLocation没有在摩托罗拉后空翻和放大器的工作;三星Galaxy [英] locationmanager.requestForLocation is not working in motorola backflip & samsung galaxy

查看:115
本文介绍了locationmanager.requestForLocation没有在摩托罗拉后空翻和放大器的工作;三星Galaxy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手在Android中,我想我的应用程序来获取GPS数据。
   我使用以下code
的LocationManager LM =(的LocationManager)getSystemService(Context.LOCATION_SERVICE);

I am newbie in Android, I am trying to retrieve the GPS data in my application. I am using following code LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

if (!lm.isProviderEnabled(LocationManager.GPS_PROVIDER)){
  lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, this);
}

和我的课我已经重写下面的方法

And my class I have overriden the following method

public void onLocationChanged(Location location)
{
  String currentLocation = "The location is changed to Lat: " + location.getLatitude()+ " Lng: " + location.getLongitude();
  Toast.makeText(context, currentLocation, Toast.LENGTH_LONG);
}

但它没有显示任何东西,这是与摩托罗拉的后空翻和放大器仅发生;三星Galaxy设备
   请让我知道如果我做错什么。先谢谢了。

But it is not showing anything and this is happening only with motorola backflip & samsung galaxy devices. Please let me know if I am doing anything wrong. Thanks in advance.

Thansk,
Devanand

Thansk, Devanand

推荐答案

您忘了使用Toast.makeText(...) .show();

You forgot to use Toast.makeText(...).show();

这篇关于locationmanager.requestForLocation没有在摩托罗拉后空翻和放大器的工作;三星Galaxy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆