JSON parsing. You're working so hard. We have implemented the simple present weather as above.
It's written in English because it's a foreign service, so can you change the language to Korean?
When I put u='c' in the query, it changed Fahrenheit to Celsius.
It would be great if there is a query command that converts English into Korean
@Override
protected String doInBackground(String... strings) {
//Yahoo query statement
String YQL = String.format("select * from weather.forecast where woeid in (select woeid from geo.places(1) where text=\"%s\") and u='c'", strings[0]);
//Yahoo API using Yahoo query statement
String endpoint = String.format("https://query.yahooapis.com/v1/public/yql?q=%s&format=json", Uri.encode(YQL));
try {
URL url = new URL(endpoint);
//Network access using Yahoo API
URLConnection connection = url.openConnection();
InputStream inputStream = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder result = new StringBuilder();
String line;
while((line = reader.readLine()) != null)
{
result.append(line);
}
return result.toString();
} } catch (Exception e) {
error = e;
}
return null;
}
I also used it a long time ago, so I looked up the data again. I don't think it supports other languages besides English. There are only two options to set: w (WOEID) and u (unit).
However, since the information on the weather conditions comes down to the code, it would be best to translate the information on the code into Korean, put it in the strings.xml, and process it on the client.
Please refer to the weather condition code below.
© 2024 OneMinuteCode. All rights reserved.