Click here to Skip to main content
15,891,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Guys the problem is am getting some errors in my android project am using drawer menu in my app and i have some fragment classes and one of main activity class and i want to open fragment activity on mainactivity oncreate function please checkout the errors and please help me and guide me
Thanks in Advance
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.complainprotectioncell, PID: 2622
java.lang.IllegalArgumentException: No view found for id 0x7f100104 (com.complainprotectioncell:id/fragment_container) for fragment FirstFragment{d9cb842 #0 id=0x7f100104}
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:987)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171)
at android.app.BackStackRecord.run(BackStackRecord.java:816)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1578)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:483)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

What I have tried:

Fragment fragment= new FirstFragment();
android.app.FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_container, fragment); // fragmen container id in first parameter is the container(Main layout id) of Activity
transaction.addToBackStack(null); // this will manage backstack
transaction.commit();
Posted
Comments
Richard MacCutchan 13-Jan-18 4:49am    
No view found for id 0x7f100104
You need to find out where this value comes from.
Member 9983063 13-Jan-18 5:35am    
which view id
David Crow 13-Jan-18 22:24pm    
Have you looked in R.java for what id is associated with value 0x7f100104?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900