android - Duplicate id with another fragment error -
i have changed causing problems , having 1 hell of time trying figure out went wrong. appears logcat have duplicate id, i'm not sure best approach fix it. have tried changing id , class in xml file neither of seemed work. here logcat getting.
06-03 08:55:20.575 3530-3530/com.rcd.mypr e/androidruntime﹕ fatal exception: main process: com.rcd.mypr, pid: 3530 java.lang.runtimeexception: unable start activity componentinfo{com.rcd.mypr/com.rcd.mypr.workouts.workoutsarticleactivity}: android.view.inflateexception: binary xml file line #22: error inflating class fragment @ android.app.activitythread.performlaunchactivity(activitythread.java:2209) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2269) @ android.app.activitythread.access$800(activitythread.java:139) @ android.app.activitythread$h.handlemessage(activitythread.java:1210) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5102) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) @ dalvik.system.nativestart.main(native method) caused by: android.view.inflateexception: binary xml file line #22: error inflating class fragment @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:713) @ android.view.layoutinflater.rinflate(layoutinflater.java:755) @ android.view.layoutinflater.inflate(layoutinflater.java:492) @ android.view.layoutinflater.inflate(layoutinflater.java:397) @ com.rcd.mypr.workouts.workoutsarticlefragment.oncreateview(workoutsarticlefragment.java:42) @ android.app.fragment.performcreateview(fragment.java:1700) @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:866) @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1040) @ android.app.fragmentmanagerimpl.addfragment(fragmentmanager.java:1142) @ android.app.activity.oncreateview(activity.java:4803) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:689) @ android.view.layoutinflater.rinflate(layoutinflater.java:755) @ android.view.layoutinflater.inflate(layoutinflater.java:492) @ android.view.layoutinflater.inflate(layoutinflater.java:397) @ android.view.layoutinflater.inflate(layoutinflater.java:353) @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:290) @ android.app.activity.setcontentview(activity.java:1937) @ android.support.v7.app.actionbaractivity.supersetcontentview(actionbaractivity.java:216) @ android.support.v7.app.actionbaractivitydelegateics.setcontentview(actionbaractivitydelegateics.java:110) @ android.support.v7.app.actionbaractivity.setcontentview(actionbaractivity.java:76) @ com.rcd.mypr.workouts.workoutsarticleactivity.oncreate(workoutsarticleactivity.java:70) @ android.app.activity.performcreate(activity.java:5248) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1110) @ android.app.activitythread.performlaunchactivity(activitythread.java:2173) at android.app.activitythread.handlelaunchactivity(activitythread.java:2269) at android.app.activitythread.access$800(activitythread.java:139) at android.app.activitythread$h.handlemessage(activitythread.java:1210) at android.os.handler.dispatchmessage(handler.java:102) at android.os.looper.loop(looper.java:136) at android.app.activitythread.main(activitythread.java:5102) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:515) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) at com.android.internal.os.zygoteinit.main(zygoteinit.java:595) at dalvik.system.nativestart.main(native method) caused by: java.lang.illegalargumentexception: binary xml file line #22: duplicate id 0x7f07004c, tag null, or parent id 0xffffffff fragment com.rcd.mypr.workouts.workoutsarticlefragment @ android.app.activity.oncreateview(activity.java:4808) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:689) at android.view.layoutinflater.rinflate(layoutinflater.java:755) at android.view.layoutinflater.inflate(layoutinflater.java:492) at android.view.layoutinflater.inflate(layoutinflater.java:397) at com.rcd.mypr.workouts.workoutsarticlefragment.oncreateview(workoutsarticlefragment.java:42) at android.app.fragment.performcreateview(fragment.java:1700) at android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:866) at android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1040) at android.app.fragmentmanagerimpl.addfragment(fragmentmanager.java:1142) at android.app.activity.oncreateview(activity.java:4803) at android.view.layoutinflater.createviewfromtag(layoutinflater.java:689) at android.view.layoutinflater.rinflate(layoutinflater.java:755) at android.view.layoutinflater.inflate(layoutinflater.java:492) at android.view.layoutinflater.inflate(layoutinflater.java:397) at android.view.layoutinflater.inflate(layoutinflater.java:353) at com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:290) at android.app.activity.setcontentview(activity.java:1937) at android.support.v7.app.actionbaractivity.supersetcontentview(actionbaractivity.java:216) at android.support.v7.app.actionbaractivitydelegateics.setcontentview(actionbaractivitydelegateics.java:110) at android.support.v7.app.actionbaractivity.setcontentview(actionbaractivity.java:76) at com.rcd.mypr.workouts.workoutsarticleactivity.oncreate(workoutsarticleactivity.java:70) at android.app.activity.performcreate(activity.java:5248) at android.app.instrumentation.callactivityoncreate(instrumentation.java:1110) at android.app.activitythread.performlaunchactivity(activitythread.java:2173) at android.app.activitythread.handlelaunchactivity(activitythread.java:2269) at android.app.activitythread.access$800(activitythread.java:139) at android.app.activitythread$h.handlemessage(activitythread.java:1210) at android.os.handler.dispatchmessage(handler.java:102) at android.os.looper.loop(looper.java:136) at android.app.activitythread.main(activitythread.java:5102) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:515) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) at com.android.internal.os.zygoteinit.main(zygoteinit.java:595) at dalvik.system.nativestart.main(native method)
here workoutsarticlefragment:42
view view = inflater.inflate(r.layout.fragment_workouts_article_view, container, false);
workoutsarticleactivity:70-73
setcontentview(r.layout.activity_detail); workoutsarticlefragment workoutsarticlefragment = (workoutsarticlefragment) getfragmentmanager() .findfragmentbyid(r.id.detailfragment); workoutsarticlefragment.updatearticleview(workoutdata);
activitydetail.xml
<?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" android:orientation="vertical"> <fragment android:id="@+id/detailfragment" android:layout_width="match_parent" android:layout_height="match_parent" class="com.rcd.mypr.workouts.workoutsarticlefragment" /> </linearlayout>
fragment_workouts_article_view.xml
<?xml version="1.0" encoding="utf-8"?><!-- copyright (c) 2012 android open source project licensed under apache license, version 2.0 (the "license"); may not use file except in compliance license. may obtain copy of license @ http://www.apache.org/licenses/license-2.0 unless required applicable law or agreed in writing, software distributed under license distributed on "as is" basis, without warranties or conditions of kind, either express or implied. see license specific language governing permissions , limitations under license. --> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:background="@color/darkgray"> <fragment android:id="@+id/detailfragment" android:layout_width="match_parent" android:layout_height="match_parent" class="com.rcd.mypr.workouts.workoutsarticlefragment" > <scrollview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/scrollview"> <tablelayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <tablerow android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/workoutname" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" android:textsize="30sp" android:text="workout name" android:textisselectable="true" android:textcolor="@color/white" android:fontfamily="sans-serif-light" /> </tablerow> <linearlayout android:layout_width="match_parent" android:layout_height="2dip" android:orientation="vertical" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:background="@color/white"></linearlayout> <tablerow android:layout_width="fill_parent" android:layout_height="fill_parent"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview" android:gravity="center" /> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:layout_width="0dp" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="name: " android:id="@+id/nametextview" android:paddingleft="5dp" android:textcolor="@color/white" android:layout_weight="1" android:fontfamily="sans-serif-light" /> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="hero description" android:id="@+id/herodescription" android:padding="5dp" android:textcolor="@color/white" android:fontfamily="sans-serif-light" /> </tablerow> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="· · ·" android:textsize="50dp" android:gravity="center" android:id="@+id/divider" android:textcolor="@color/white" android:fontfamily="sans-serif-light" /> <tablerow android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:background="@drawable/dashed_line" android:layout_marginleft="5dp" android:layout_marginright="5dp"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="workout measurement" android:id="@+id/workoutmeasurement" android:padding="5dp" android:textcolor="@color/white" android:fontfamily="sans-serif-light" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="workout info" android:id="@+id/workoutinfo" android:padding="5dp" android:textcolor="@color/white" android:fontfamily="sans-serif-light" /> </linearlayout> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="date added: " android:id="@+id/dateadded" android:padding="5dp" android:textcolor="@color/white" android:fontfamily="sans-serif-light" /> </tablerow> </tablelayout> </scrollview> </fragment> </linearlayout>
could please lend suggestion how can around this? again, feel ive tried swapping id of fragments, , classes either npe or error.
i removed following xml file , worked correctly again.
<fragment android:id="@+id/detailfragment" android:layout_width="match_parent" android:layout_height="match_parent" class="com.rcd.mypr.workouts.workoutsarticlefragment" >
Comments
Post a Comment