Attempt to write to field ' Android.support.v4.app.FragmentManagerImpl Android.support.v4.app.Fragment.mFragmentManager ' on a null object reference

Source: Internet
Author: User

E/androidruntime:fatal Exception:main
Process:org.example.magnusluca.drawertestapp, pid:3624
Java.lang.NullPointerException: attempt to write to field ' Android.support.v4.app.FragmentManagerImpl Android.support.v4.app.Fragment.mFragmentManager ' on a null object reference
The previous code was not modified:

 Public classOrdermanagerfragmentpageradapterextendsFragmentpageradapter {PrivateFollowingResult.DataEntity.CountEntity countentity;  PublicOrdermanagerfragmentpageradapter (fragmentmanager FM, FollowingResult.DataEntity.CountEntity countentity) { Super(FM);  This. countentity =countentity; } @Override Public voidDestroyitem (ViewGroup container,intposition, Object object) {            //Super.destroyitem (container, Position, object);} @Override PublicFragment GetItem (intposition) {ordermanagerfragment Badgerefreshlistener=ordermanagerfragment. This; String Strtabtitle=Titles[position]; Switch(strtabtitle) { Case"New Order":                    returnneworderfragment.newinstance (Badgerefreshlistener);  Case"In-Trace":                    returnneworderfragment.newinstance (Badgerefreshlistener);  Case"Turn Out":                    returnneworderfragment.newinstance (Badgerefreshlistener);  CaseSold Prices:                    returnneworderfragment.newinstance (Badgerefreshlistener);  CaseLoss:                    returnneworderfragment.newinstance (Badgerefreshlistener);  CaseInvalid:                    returnneworderfragment.newinstance (Badgerefreshlistener); default:                    return null ; }} @Override PublicCharsequence Getpagetitle (intposition) {            returnTitles[position%Titles.length]; } @Override Public intGetCount () {returntitles.length; }    }
 

The problem occurs mainly in the red Place, the code has been modified to

return new Neworderfragment ();
Problem solving

StackOverflow above solution: Http://stackoverflow.com/questions/26822516/how-to-display-3-fragments-inside-pageviewer

Attempt to write to field ' Android.support.v4.app.FragmentManagerImpl Android.support.v4.app.Fragment.mFragmentManager ' on a null object reference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.