小编RAJ*_*ESH的帖子

Android如何在LocationManager中获取海拔高度。我总是零

我正在尝试从location.getAltitude()方法获取当前海拔高度。但它始终返回零。我应该怎么做才能获得当前的海拔高度值。但正确获取经度和纬度。请给我建议。我已经在google中搜索并得出了一些示例,但所有示例仅返回零。

我使用的代码:

在创建时我调用了= getMyCurrentLocation(); 这种方法。

void getMyCurrentLocation() {
        LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        LocationListener locListener = new MyLocationListener();
try{gps_enabled=locManager.isProviderEnabled(LocationManager.GPS_PROVIDER);}catch(Exception ex){}
           try{network_enabled=locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);}catch(Exception ex){}  
if(gps_enabled){

                locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener);

            }

            if(network_enabled){
                locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locListener);

            }


        if(gps_enabled){
                location=locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);



            }

            if(network_enabled && location==null)   {
                location=locManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);  

            }

        if (location != null) {

            MyLat = location.getLatitude();
            MyLong = location.getLongitude();
    Toast.makeText(this,"My Lat : " + MyLat + "\n" + "My Long : " + MyLong, Toast.LENGTH_SHORT).show();

        } else {

        }


        System.out.println(" LATTITUDE " + MyLat);
        System.out.println("Longitude …
Run Code Online (Sandbox Code Playgroud)

android altitude

5
推荐指数
1
解决办法
6506
查看次数

Android如何获取特定文件夹中可用的视频文件持续时间?

我正在研究android中的视频文件持续时间查找.但我无法得到它.我的视频文件位于SD卡的特定文件夹中.想要将它们作为列表视图与持续时间和名称绑定.我有名字.但搜索解决方案以查找持续时间.请帮我 .提前致谢 .

拉杰什.

video android duration

2
推荐指数
1
解决办法
7276
查看次数

Android如何创建圆形图库的默认图库?

我想创建如下图所示的图库视图.我已经瞪了很多眼镜,并尝试过旋转木马.但我无法创造它.任何人都可以建议我创建这样的视图吗?我也尝试过画廊视图样式.但我没有找到任何东西.

等待更好的回应.谢谢.

在此输入图像描述

geometry android android-gallery

2
推荐指数
1
解决办法
1278
查看次数

标签 统计

android ×3

altitude ×1

android-gallery ×1

duration ×1

geometry ×1

video ×1