This is my .xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.root.googlemap.MapsActivity" />
<fragment
android:id="@+id/autocomplete_fragment"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
This is my .java
PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getFragmentManager().findFragmentById(R.id.autocomplete_fragment);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
Log.i(TAG,"Place"+ place.getName());
}
@Override
public void onError(Status status) {
Log.i(TAG, "Status" +status);
}
});
I need to load the some locations based on my input in text view. But it is not loaded. I think the problem is Two fragments are used in same file. How to Load the location suggestions and how to use PlaceAutocompleteFragment inside the mapfragment.