Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android OpenWeatherMapAPI没有';不要更改所需城市的当地时间_Android - Fatal编程技术网

Android OpenWeatherMapAPI没有';不要更改所需城市的当地时间

Android OpenWeatherMapAPI没有';不要更改所需城市的当地时间,android,Android,当我改变城市位置时,时间不会改变,其他一切都会改变。在美国,日出和日落都会改为加利福尼亚时间。我想改为我指定的城市的当地时间 JSONObject jsonObj = new JSONObject(result); JSONObject main = jsonObj.getJSONObject("main"); JSONObject sys = jsonObj.getJSONObject("sys"); JSONObject wind = jsonObj.

当我改变城市位置时,时间不会改变,其他一切都会改变。在美国,日出和日落都会改为加利福尼亚时间。我想改为我指定的城市的当地时间

JSONObject jsonObj = new JSONObject(result);
JSONObject main = jsonObj.getJSONObject("main");
JSONObject sys = jsonObj.getJSONObject("sys");
JSONObject wind = jsonObj.getJSONObject("wind");
JSONObject weather = jsonObj.getJSONArray("weather").getJSONObject(0);
Long updatedAt = jsonObj.getLong("dt");
String updatedAtText = "Updated at:   " + new SimpleDateFormat("MM/dd/YYYY   hh:mm a", Locale.ENGLISH).format(updatedAt * 1000);
Long sunrise = sys.getLong("sunrise");
Long sunset = sys.getLong("sunset");
sunrised.setText(new SimpleDateFormat("hh:mm a", Locale.ENGLISH).format(new Date(sunrise * 1000)));
sunsetted.setText(new SimpleDateFormat("hh:mm a", Locale.ENGLISH).format(new Date(sunset * 1000)));`

粘贴的代码片段对调试您面临的问题没有多大帮助。它可能出现在一个网络调用中,也可能出现在更新UI中。不看一下代码就不可能知道。你能分享你代码的在线git回购吗?