Hello, there is my code :
(It's list of some cities in France)
So, we have 2 lists: "streetAddress" and "laville".
The "streetAddress" list will allow us to add the exact address entered by the user in GooglePlace Autocomplete.
The list "laville" will then allow us to retrieve only the city of the address that has been registered in the list "streetAddress".
Now, I would like to check: if the word "Puteaux" is registered in the list "streetAddress" then we add it automatically to the list "laville".
So I am stuck on this subject, could someone help me? thank you in advance.
If you want to know more, please let me know by comment.
(It's list of some cities in France)
Java:
public static String[] Country = new String[]{"Antony", "Châtenay-Malabry", "Sceaux", "Bourg-la-Reine", "Bagneux", "Fontenay-aux-Roses"
, "Le Plessis-Robinson", "Clamart", "Châtillon", "Montrouge", "Malakoff", "Vanves", "Issy-les-Moulineaux", "Boulogne-Billancourt",
"Meudon", "Sèvres", "Chaville", "Ville-d'Avray", "Saint-Cloud", "Marnes-la-Coquette", "Vaucresson", "Garches", "Rueil-Malmaison",
"Suresnes", "Puteaux", "Nanterre", "Colombes", "La Garenne-Colombes", "Bois-Colombes", "Courbevoie", "Neuilly-sur-Seine", "Levallois-Perret",
"Clichy", "Asnières-sur-Seine", "Gennevilliers", "Villeneuve-la-Garenne",
"Paris 75001", "Paris 75002", "Paris 75003", "Paris 75004", "Paris 75005", "Paris 75006", "Paris 75007", "Paris 75008", "Paris 75009",
"Paris 75010", "Paris 75011", "Paris 75012", "Paris 75013", "Paris 75014", "Paris 75015", "Paris 75016", "Paris 75017", "Paris 75018",
"Paris 75019", "Paris 75020",};
Java:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
// retrive the data by using getPlace() method.
Place place = PlaceAutocomplete.getPlace(this, data);
showAddress();
streetAddress.clear();
adresse.setText(place.getAddress());
streetAddress.add("" + place.getAddress());
villeAdresse();
} else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
Status status = PlaceAutocomplete.getStatus(this, data);
// TODO: Handle the error.
//
} else if (resultCode == RESULT_CANCELED) {
// The user canceled the operation.
}
}
}
Java:
private void villeAdresse() {
if(streetAddress.contains(Country)) {
laville.clear();
laville.add(Country);
}
}
So, we have 2 lists: "streetAddress" and "laville".
The "streetAddress" list will allow us to add the exact address entered by the user in GooglePlace Autocomplete.
The list "laville" will then allow us to retrieve only the city of the address that has been registered in the list "streetAddress".
Now, I would like to check: if the word "Puteaux" is registered in the list "streetAddress" then we add it automatically to the list "laville".
So I am stuck on this subject, could someone help me? thank you in advance.
If you want to know more, please let me know by comment.