Error while implementing Fragments in Android -


i working on android app. want playstore ui, put horizontal drawer , made of activities fragments. when open activity, crashes, means "unfortunately app stopped".

message in log:

04-06 17:24:07.616: e/androidruntime(1059): fatal exception: main 04-06 17:24:07.616: e/androidruntime(1059): java.lang.runtimeexception: unable start activity componentinfo{com.bingo.main/com.bingo.main.start}: java.lang.nullpointerexception 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.activitythread.access$600(activitythread.java:141) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.activitythread$h.handlemessage(activitythread.java:1234) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.os.handler.dispatchmessage(handler.java:99) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.os.looper.loop(looper.java:137) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.activitythread.main(activitythread.java:5041) 04-06 17:24:07.616: e/androidruntime(1059):     @ java.lang.reflect.method.invokenative(native method) 04-06 17:24:07.616: e/androidruntime(1059):     @ java.lang.reflect.method.invoke(method.java:511) 04-06 17:24:07.616: e/androidruntime(1059):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 04-06 17:24:07.616: e/androidruntime(1059):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 04-06 17:24:07.616: e/androidruntime(1059):     @ dalvik.system.nativestart.main(native method) 04-06 17:24:07.616: e/androidruntime(1059): caused by: java.lang.nullpointerexception 04-06 17:24:07.616: e/androidruntime(1059):     @ com.bingo.main.recruitment.oncreateview(recruitment.java:21) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.fragment.performcreateview(fragment.java:1695) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:885) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1057) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.backstackrecord.run(backstackrecord.java:682) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1435) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.activity.performstart(activity.java:5113) 04-06 17:24:07.616: e/androidruntime(1059):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2153) 04-06 17:24:07.616: e/androidruntime(1059):     ... 11 more 

if remove following statement works without fragments:

 fragmentmanager fragmentmanager = getfragmentmanager();   fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction();  fragmenttransaction.replace(r.id.content_frame, fragment);  fragmenttransaction.commit();` 

please me out!

as marco said, have class called recruitment , in oncreateview() method there null pointerexception - @ line 21. try debugging program , find out null - possibly fragmentmanager or in line:

fragmenttransaction.replace(r.id.content_frame, fragment); 

you may not have 'fragment' instantiated yet.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -