I have this type of error can you help me how can i solve it
or what is the problem
knowing that this code i use it with other spinner with other class and it is work
so it kind of confusing me
dose the problem having because i have to spinner or it not?
her is my logcat
11-16 21:56:27.841: E/AndroidRuntime(794): FATAL EXCEPTION: main
11-16 21:56:27.841: E/AndroidRuntime(794): java.lang.NullPointerException
11-16 21:56:27.841: E/AndroidRuntime(794): at android.widget.ArrayAdapter.getCount(ArrayAdapter.java:291)
11-16 21:56:27.841: E/AndroidRuntime(794): at android.widget.AbsSpinner.setAdapter(AbsSpinner.java:113)
11-16 21:56:27.841: E/AndroidRuntime(794): at com.example.test1.MainActivity$LoadAllSection.onPostExecute(MainActivity.java:220)
11-16 21:56:27.841: E/AndroidRuntime(794): at com.example.test1.MainActivity$LoadAllSection.onPostExecute(MainActivity.java:1)
11-16 21:56:27.841: E/AndroidRuntime(794): at android.os.AsyncTask.finish(AsyncTask.java:417)
11-16 21:56:27.841: E/AndroidRuntime(794): at android.os.AsyncTask.access$300(AsyncTask.java:127)
11-16 21:56:27.841: E/AndroidRuntime(794): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
11-16 21:56:27.841: E/AndroidRuntime(794): at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 21:56:27.841: E/AndroidRuntime(794): at android.os.Looper.loop(Looper.java:123)
11-16 21:56:27.841: E/AndroidRuntime(794): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-16 21:56:27.841: E/AndroidRuntime(794): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 21:56:27.841: E/AndroidRuntime(794): at java.lang.reflect.Method.invoke(Method.java:521)
11-16 21:56:27.841: E/AndroidRuntime(794): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-16 21:56:27.841: E/AndroidRuntime(794): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-16 21:56:27.841: E/AndroidRuntime(794): at dalvik.system.NativeStart.main(Native Method)
From the logcat:
And since you said this is line 195:
It simply means that
sectionListisnull, you forgot to initialize it with:Ok, with your new LogCat the trouble starts with line 220, which appears to be:
Once again
sectionListis to blame, this error only occurs when you try to pass an adapter bound to anulldataset.