I created an app that will set the current location, and the text of the location is in the button.. Then, when I click that button, it will show the PlaceAutocomplete. But, what happens is when I clicked that button, it will only show the PlaceAutocomplete for 1 second then closes automatically.. and when I'm looking in my logcat there's no error
I got my API Key from google, and put it in my google_maps_api.xml file.
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">API_KEY</string>
and in my manifest I added this:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
Now below is the button I created. I'm confused where is my mistake.
b4_sourceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
Intent i = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY).build(MainPageActivity.this);
startActivityForResult(i,200);
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
});
It should just show the PlaceAutoComplete on click of my button. That's all..