android.view.InflateException: Binary XML file line #69: Error inflating class fragment

Multi tool use
android.view.InflateException: Binary XML file line #69: Error inflating class fragment
I have a RecyclerView which is a vertical scrolling list of maps. Each map contain a polygon lines in between two points. when i am scrolling down i am getting inflation error in my adapter class.
log details
android.view.InflateException: Binary XML file line #69: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at Adapter_class.Following_Frag_Adapter.onCreateViewHolder(Following_Frag_Adapter.java:53)
at Adapter_class.Following_Frag_Adapter.onCreateViewHolder(Following_Frag_Adapter.java:39)
I am not able to solve this please help
XML Code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:map="http://schemas.android.com/tools"
android:orientation="vertical">
<TextView
android:id="@+id/user_name"
android:text="Name"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="150dp"/>
</LinearLayout>
In Adapter Class
In this class i am getting inflation errors please help me.
Adapter Class
public class Following_Frag_Adapter extends RecyclerView.Adapter<Following_Frag_Adapter.MyViewHolder> {
private GoogleMap mMap;
private LatLng mMapLocation;
private String name;
private FragmentManager fragmentmanager;
public Following_Frag_Adapter(String name, FragmentManager fragmentmanager) {
this.name = name;
this.fragmentmanager = fragmentmanager;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.following_frag_adapter, parent, false);
return new MyViewHolder(itemView);
}
public class MyViewHolder extends RecyclerView.ViewHolder {
CustomFontTextView user_name;
SupportMapFragment kasualjobmap;
MyViewHolder(final View view) {
super(view);
user_name = view.findViewById(R.id.user_name);
kasualjobmap = (SupportMapFragment)fragmentmanager.findFragmentById(R.id.map);
}
public void setMapLocation(double lat, double lon) {
mMapLocation = new LatLng(lat, lon);
if (mMap != null) {
updateMapContents();
}
}
protected void updateMapContents() {
mMap.clear();
// Update the mapView feature data and camera position.
mMap.addMarker(new MarkerOptions().position(mMapLocation));
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(mMapLocation, 10f);
mMap.moveCamera(cameraUpdate);
}
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.user_name.setText(name[position]);
holder.kasualjobmap.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
});
}
@Override
public int getItemCount() {
return name.length;
}
}
Fragment class
public class Following_Fragment extends Fragment {
String name = {"Name1", "Name1", "Name1", "Name1", "Name1", "Name1"};
RecyclerView following_recycler_view;
Following_Frag_Adapter adapter;
public Following_Fragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_following, container, false);
following_recycler_view = view.findViewById(R.id.following_recycler_view);
following_recycler_view.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
adapter = new Following_Frag_Adapter(name, getActivity().getSupportFragmentManager());
following_recycler_view.setAdapter(adapter);
adapter.notifyDataSetChanged();
return view;
}
}
Include the contents of fragment_following.xml
– Ahamad Anees
Jul 3 at 7:32
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Can you share which dependencies you have used?
– Harsh Jain
Jul 3 at 7:32