Answer the question
In order to leave comments, you need to log in
How to specify query parameter "Cyrillic" on OpenWeatherMap?
Hello!
I am writing a weather forecast application. I organized the input of the name of the city through the menu and like this:
private void showInputDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Change city");
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_TEXT);
builder.setView(input);
builder.setPositiveButton("Go", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getWeather(v, input.getText().toString());
}
});
builder.show();
Answer the question
In order to leave comments, you need to log in
This API has the ability to set coordinates instead of the city name.
api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}
It is possible to have a localized database of cities with coordinates in the application and call the API always by coordinates, and then the name of the city can be any language to enter.
You can even try not to store the coordinates of cities in the application, but conditionally google by the name of the city or get geolocation from the device on which the application is running.
Good afternoon!
Here is what is written in the documentation about the names of cities.
By city name. Input the city name or its part and get the list of the most proper cities in the world. Example - Lon or Lond or London. The more precise city name you put the more precise list you will get. To make it more precise put the city's name or its part, comma, the name of the county or 2-letter country code. You will get all proper cities in chosen county. The order is important - the first is city name than comma than county. Example - Lon, UK or Lon, GB or London, GB or Lon, England. By geographic coordinates.
LONDON ("London", "Лондон")
Organized the input of the name of the city through the menu and this way
Hello guys, you need to use ssh instead of login login password. And it’s even better not to use Windows, it’s a pity that they don’t say it right away
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question