【发布时间】:2019-11-25 11:34:34
【问题描述】:
我尝试制作一个天气应用程序,但我使用 API 密钥遇到了这个问题,但我不知道该怎么办!
public void findWeather(View view) {
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
assert mgr != null;
mgr.hideSoftInputFromWindow(cityName.getWindowToken(), 0);
try {
String encodedCityName = URLEncoder.encode(cityName.getText().toString(), "UTF-8");
DownloadTask task = new DownloadTask();
task.execute("api.openweathermap.org/data/2.5/weather?q="+encodedCityName+"&APPID=94064dfafb01980f851258909ec27129");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Could not find weather", Toast.LENGTH_LONG);
}
}
【问题讨论】:
-
使用改造处理 REST Api Web 服务调用
-
检查帐单..