无法找到此logcat消息中的问题
我似乎无法在此logcat消息中找到崩溃的根源。 我真的希望有人能够帮助它。 如果不是不担心。 以下是我在应用程序崩溃之前得到的消息:(我真的很抱歉这么久)
十一月9日至11日:34:00.889 22547-22547 / co.uk.mednet.mednet_ghana E / AndroidRuntime:致命异常:主要过程:co.uk.mednet.mednet_ghana,PID:22547显示java.lang.NullPointerException:尝试调用虚拟上在co.uk.mednet.mednet_ghana.fragments.PatientInofrmationFragment.onCreateView(PatientInofrmationFragment.java:76)空对象引用方法“java.lang.String中co.uk.mednet.mednet_ghana.model.User.getTitle()”在android.support.v4.app.Fragment.performCreateView(Fragment.java:2192)在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)在android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState( FragmentManager.java:1528)在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)在android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)在android.support.v4 .app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentMa nager.java:2149)在android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)在android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1984)在android.support.v4 .app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:626)在android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)在android.support.v4.view.ViewPager.populate(ViewPager.java:1268 )在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)在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908)在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435)在android.widget.LinearLayout.measureVertical(LinearLayout.java:721)在在android.view.ViewGroup.measure上的android.view.View.measure(View.java:18926)android.widget.LinearLayout.onMeasure(LinearLayout.java:612) ChildWithMargins(ViewGroup.java:5908)在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435)在android.widget.LinearLayout.measureVertical(LinearLayout.java:721)在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)在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908)在android.widget.FrameLayout.onMeasure(FrameLayout.java:436)在android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139 )在android.view.View.measure(View.java:18926)在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908)在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435)在android.widget .LinearLayout.measureVertical(LinearLayout.java:721)在android.widget.LinearLayout.onMeasure(LinearLayout.java:612)at android.view.View.measure( View.java:18926)在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908)在android.widget.FrameLayout.onMeasure(FrameLayout.java:436)在android.view.View.measure(View.java:18926 )在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908)在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435)在android.widget.LinearLayout.measureVertical(LinearLayout.java:721)在android.widget .LinearLayout.onMeasure(LinearLayout.java:612)在android.view.View.measure(View.java:18926)在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5908)在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代码:
//----------------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;
}
在你的崩溃看看这条线。
co.uk.mednet.mednet_ghana.model.User.getTitle()' on a null object reference
我想你还没有初始化 用户 。
检查您的初始化,或者如果您从服务器接收它,请确保检查用户模型是否为空 。
问题的根源在这里:
尝试在co.uk.mednet.mednet_ghana.fragments.PatientInofrmationFragment.onCreateView(PatientInofrmationFragment.java)的空对象引用上调用虚拟方法'java.lang.String co.uk.mednet.mednet_ghana.model.User.getTitle()' :76)at
异常是一个NullPointerException:
java.lang.NullPointerException:尝试在空对象引用上调用虚拟方法'java.lang.String co.uk.mednet.mednet_ghana.model.User.getTitle()'
您正尝试在空实例上调用.getTitle()方法。
这里抛出了异常:
co.uk.mednet.mednet_ghana.fragments.PatientInofrmationFragment.onCreateView(PatientInofrmationFragment.java)
在第76行
链接地址: http://www.djcxy.com/p/84735.html上一篇: Having trouble finding where the issue in this logcat message