Error inflating class fragment Android kotlin

0

Error

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.pockethcm.greytrix.test, PID: 6566 android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class fragment Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class fragment Caused by: java.lang.IllegalArgumentException: Binary XML file line #29: Duplicate id 0x7f09012d, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.maps.SupportMapFragment at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3680) at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338) at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39) at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:420) at android.app.Dialog.setContentView(Dialog.java:557) at com.pockethcm.greytrix.test.Fragments.DashboardFragment.openPunchDetailDialog(DashboardFragment.kt:1183) at com.pockethcm.greytrix.test.Fragments.DashboardFragment$sendLocationData$1.onSuccess(DashboardFragment.kt:767) at com.pockethcm.greytrix.test.Fragments.DashboardFragment$sendLocationData$1.onSuccess(DashboardFragment.kt:102) at com.google.android.gms.tasks.zzj.run(Unknown Source:27) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Fragment Code

  var mapFragment = activity.supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
    if(mapFragment != null){
        mapFragment!!.getMapAsync(OnMapReadyCallback {
            googleMap = it
            val location1 = LatLng(13.03,77.60)
            val location2 = LatLng(13.53,77.67)
            googleMap.addMarker(MarkerOptions().position(location1).title("First Location"))
            googleMap.addMarker(MarkerOptions().position(location2).title("Second Location"))

            val center = CameraUpdateFactory.newLatLng(location1)
            val zoom = CameraUpdateFactory.zoomTo(15f)
            val markerPoints = LatLngBounds(
                    location1, location2)
            googleMap.setOnMapLoadedCallback(GoogleMap.OnMapLoadedCallback {
                googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(markerPoints,30))
            })
        })
    }

punchdetailLayout

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="200dp"
   />

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="10dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
      <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/view_layout"
            android:orientation="vertical"
            android:layout_marginRight="15dp"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginTop="10dp"
                >
                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="Address"
                    android:layout_weight="0.5"
                    android:textColor="#000000"
                    />
                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:id="@+id/address"
                    android:textColor="#000000"
                    android:layout_weight="0.5"
                    />
            </LinearLayout>
          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              android:layout_marginTop="10dp"
              >
              <TextView
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:text="Locality"
                  android:layout_weight="0.5"
                  android:textColor="#000000"
                  />
              <TextView
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:id="@+id/locality"
                  android:textColor="#000000"
                  android:layout_weight="0.5"
                  />
          </LinearLayout>
          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              android:layout_marginTop="10dp"
              >
              <TextView
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:text="Time"
                  android:layout_weight="0.5"
                  android:textColor="#000000"
                  />
              <TextView
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:id="@+id/time"
                  android:textColor="#000000"
                  android:layout_weight="0.5"
                  />
          </LinearLayout>
          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              android:layout_marginTop="10dp"
              >
              <Button
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:id="@+id/ok"
                  android:text="OK">
              </Button>
          </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="No Records Found!"
        android:gravity="center"
        android:layout_marginTop="20dp"
        android:layout_marginBottom="20dp"
        android:visibility="gone"
        android:id="@+id/no_rec"
        />
</android.support.v7.widget.CardView>

java
android
kotlin
asked on Stack Overflow Nov 2, 2018 by develope_AK • edited Nov 2, 2018 by develope_AK

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0