我正在尝试从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中的视频文件持续时间查找.但我无法得到它.我的视频文件位于SD卡的特定文件夹中.想要将它们作为列表视图与持续时间和名称绑定.我有名字.但搜索解决方案以查找持续时间.请帮我 .提前致谢 .
拉杰什.
我想创建如下图所示的图库视图.我已经瞪了很多眼镜,并尝试过旋转木马.但我无法创造它.任何人都可以建议我创建这样的视图吗?我也尝试过画廊视图样式.但我没有找到任何东西.
等待更好的回应.谢谢.