为什么Android源文件中的第三行会导致下面的堆栈跟踪?我从getActivity
获取此行的上下文... SectionRowListAdapter adapter = new SectionRowListAdapter(getActivity());
Class ArrayAdapter
private void init(Context context, int resource, int textViewResourceId, List<T> objects) {
mContext = context;
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
堆栈跟踪
java.lang.NullPointerException
at android.widget.ArrayAdapter.init(ArrayAdapter.java:310)
at android.widget.ArrayAdapter.<init>(ArrayAdapter.java:104)
at com.exposure.adapters.SectionRowListAdapter.<init>(SectionRowListAdapter.java:21)
at com.exposure.fragments.BaseGroupListFragment.getData(BaseGroupListFragment.java:39)
at com.exposure.utilities.ActivityContainer.getData(ActivityContainer.java:62)
at com.exposure.utilities.DataTask.onPostExecute(DataTask.java:30)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:4777)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method