i'm using CustomPlaceAutoCompleteFragment inside dialog while opening first time it works but after that i change to another fragment and open that dialog it getting crash.
here is crash log.
android.view.InflateException: Binary XML file line #62: Binary XML file line #62: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #62: Error inflating class fragment
Caused by: java.lang.IllegalArgumentException: Binary XML file line #62: Duplicate id 0x7f0900d7, tag null, or parent id 0xffffffff with another fragment for com.nodomain.kishan.Testing.Customs.CustomPlaceAutoCompleteFragment
code is here my dialog code is
LayoutInflater inflater = getLayoutInflater();
View viewInside = inflater.inflate(R.layout.search_dialog_custom, null);
CustomPlaceAutoCompleteFragment placeAutocompleteFragment = (CustomPlaceAutoCompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment_dialog);
final AppCompatSpinner spCityType = viewInside.findViewById(R.id.cityType);
AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
//.setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
.setTypeFilter(AutocompleteFilter.TYPE_FILTER_REGIONS)
.setCountry(sharedPreference.getString(GlobalVariable._sharCountryCode,""))
.build();
placeAutocompleteFragment.setFilter(typeFilter);
placeAutocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
//places.setText(""+place.getAddress());
//city = place.getName().toString().trim();
tempCity = place.getAddress().toString().trim().toString();
}
@Override
public void onError(Status status) {
}
});
here is xml fragment :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:orientation="horizontal"
android:weightSum="1">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_weight="0.15"
android:src="@drawable/reg_city" />
<LinearLayout
android:layout_weight="0.85"
android:layout_width="0dp"
android:focusable="true"
android:layout_marginLeft="5dp"
android:layout_height="wrap_content">
<fragment
android:id="@+id/place_autocomplete_fragment_dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.********.kishan.********.Customs.CustomPlaceAutoCompleteFragment"
tools:layout="@layout/custom_place_auto_complete_fragment" />
</LinearLayout>
its show me error in this line while i used another layout inflater on button click which i used in custom dialog.
View viewInside = inflater.inflate(R.layout.search_dialog_custom, null);
User contributions licensed under CC BY-SA 3.0