1

I have a fragment inside a sliding pane layout.Every component has id attribute to it.

<FrameLayout
    android:id="@+id/interviewDetailsScreen"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="left"
    android:background="#FFFFFF" />

<LinearLayout
    android:id="@+id/candidateDetailScreen"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    android:baselineAligned="false"
    android:orientation="horizontal"
    android:weightSum="4" >

    <fragment
        android:id="@+id/candidateSummaryFragment"
        android:name="com.ultimatix.ncp.activity.ui.NCPCandidateSummaryFragment"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="#808080" />

    <fragment
        android:id="@+id/candidateDetailFragment"
        android:name="com.ultimatix.ncp.activity.ui.NCPCandidateDetailsFragment"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="3"
        android:background="#FFFFFF"
        android:visibility="gone" />
</LinearLayout>

and I am replacing one of the fragments with use of FragmentTransaction.

ft.replace(R.id.candidateSummaryFragment, new NCPCandidateSummaryFragment());
    ft.commit();

But error it shows the error. java.lang.IllegalArgumentException: No view found for id 0x7f0b0074 for fragment NCPCandidateSummaryFragment{40decd50 #3 id=0x7f0b0074}

The R.java also has the entry regarding the fragment with same hex and id.

2
  • 2
    I do not think that fragments statically define can be replaced
    – Blackbelt
    Jul 23, 2013 at 7:20
  • Are you using ViewPager?
    – Leo Nguyen
    Dec 23, 2013 at 3:25

1 Answer 1

5

May be your current activity does not have this xml file in setContentView(). You must specify a view for fragment that is child of current layout of your activity.

Check setContentView(R.layout.yourlayot) function, I think problem is there.

1
  • thanks for replying but its there setContentView(R.layout.ncp_interview_evaluation_home_layout); Jul 23, 2013 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.