I am building an application that will street address from user's input using GeoCoder. Herewith piece of code I made:
Geocoder gc = new Geocoder(getBaseContext(), Locale.getDefault());
List<Address> addresses = null;
StringBuilder sb = new StringBuilder();
String destination = edittext_destination.getText().toString();
try {
addresses = gc.getFromLocationName(destination, 10);
} catch (Exception e){
Toast.makeText(getBaseContext(), "Address not found", Toast.LENGTH_SHORT).show();
}
the code above is working but it takes some time to return the result. While waiting for the result I want to display progress spinner. I know that it should use Thread but I don't know how to start. I do hope anyone can help.
Thank you