Having trouble finding where the issue in this logcat message
I just can't seem to find the root of the crash in this logcat message. I really hope someone can help with it. If not no worries. Here is the message I'm getting right before the app crashes: (i'm really sorry for it being so long)
09-11 11:34:00.889 22547-22547/co.uk.mednet.mednet_ghana E/AndroidRuntime: FATAL EXCEPTION: main Process: co.uk.mednet.mednet_ghana, PID: 22547 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String co.uk.mednet.mednet_ghana.model.User.getTitle()' on a null object reference at co.uk.mednet.mednet_ghana.fragments.PatientInofrmationFragment.onCreateView(PatientInofrmationFragment.java:76) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentMa nager.java:2149) at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103) at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1984) at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:626) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143) at android.support.v4.view.ViewPager.populate(ViewPager.java:1268) at android.support.v4.view.ViewPager.populate(ViewPager.java:1116) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1642) at android.view.View.measure(View.java:18926) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435) at android.widget.LinearLayout.measureVertical(LinearLayout.java:721) at android.widget.LinearLayout.onMeasure(LinearLayout.java:612) at android.view.View.measure(View.java:18926) at android.view.ViewGroup.measure ChildWithMargins(ViewGroup.java:5908) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435) at android.widget.LinearLayout.measureVertical(LinearLayout.java:721) at android.widget.LinearLayout.onMeasure(LinearLayout.java:612) at android.view.View.measure(View.java:18926) at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1081) at android.view.View.measure(View.java:18926) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.FrameLayout.onMeasure(FrameLayout.java:436) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:18926) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435) at android.widget.LinearLayout.measureVertical(LinearLayout.java:721) at android.widget.LinearLayout.onMeasure(LinearLayout.java:612) at android.view.View.measure( View.java:18926) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.FrameLayout.onMeasure(FrameLayout.java:436) at android.view.View.measure(View.java:18926) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435) at android.widget.LinearLayout.measureVertical(LinearLayout.java:721) at android.widget.LinearLayout.onMeasure(LinearLayout.java:612) at android.view.View.measure(View.java:18926) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908) at android.widget.FrameLayout.onMeasure(FrameLayout.java:436) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:3076) at android.view.View.measure(View.java:18926) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2411) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1429) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java: 1677) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1314) at androi
OnCreateView Code:
//----------------find by view--------------
mTextName = (TextView) view.findViewById(R.id.Patient_info_text_name_patient);
mEditFirstname = (EditText) view.findViewById(R.id.Patient_info_editText_firstname);
mEditLastname = (EditText) view.findViewById(R.id.Patient_info_editText_lastname);
mTextEmail = (TextView) view.findViewById(R.id.Patient_info_text_email_patient);
mEditEmail = (EditText) view.findViewById(R.id.Patient_info_editText_email);
mTextPhone = (TextView) view.findViewById(R.id.Patient_info_text_phone_patient);
mEditPhone = (EditText) view.findViewById(R.id.Patient_info_editText_phone);
mTextNum = (TextView) view.findViewById(R.id.Patient_info_text_num_patient);
mEditNum = (EditText) view.findViewById(R.id.Patient_info_editText_num);
mTextHCP = (TextView) view.findViewById(R.id.Patient_info_text_hcp_patient);
mEditHCP = (EditText) view.findViewById(R.id.Patient_info_editText_hcp);
mEditFirstname.setVisibility(View.GONE);
mEditLastname.setVisibility(View.GONE);
mTextName.setText(PatientActivity.sPatient.getLastname()+" "+PatientActivity.sPatient.getFirstname());
mEditEmail.setVisibility(View.GONE);
mTextEmail.setText(PatientActivity.sPatient.getEmail());
mEditPhone.setVisibility(View.GONE);
mTextPhone.setText(Long.toString(PatientActivity.sPatient.getPhone_number()));
mEditNum.setVisibility(View.GONE);
mTextNum.setText(PatientActivity.sPatient.getPatient_number());
mEditHCP.setVisibility(View.GONE);
mTextHCP.setText(format("{0}. {1}", PatientActivity.sHCP.getTitle(), PatientActivity.sHCP.getLastname()));
return view;
}
In your crash look at this line.
co.uk.mednet.mednet_ghana.model.User.getTitle()' on a null object reference
I think you have not initialized the User .
Check your initialization or if you're receiving it from server make sure to check the User model is Not null .
Root of the problem here:
Attempt to invoke virtual method 'java.lang.String co.uk.mednet.mednet_ghana.model.User.getTitle()' on a null object reference at co.uk.mednet.mednet_ghana.fragments.PatientInofrmationFragment.onCreateView(PatientInofrmationFragment.java:76) at
The exception is a NullPointerException:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String co.uk.mednet.mednet_ghana.model.User.getTitle()' on a null object reference
You are trying to call the .getTitle() method on a null instance.
The exception has been thrown here:
co.uk.mednet.mednet_ghana.fragments.PatientInofrmationFragment.onCreateView(PatientInofrmationFragment.java)
at line 76
链接地址: http://www.djcxy.com/p/84736.html上一篇: TableLayout Android棒棒糖上的崩溃应用程序
下一篇: 无法找到此logcat消息中的问题