#android #spinner #adapter #android-spinner
#Android #счетчик #адаптер #android-счетчик
Вопрос:
У меня есть эти файлы:
1- Option.java => myActivity
2- CurrencyAdapterList => where i have defined myAdapter for the spinner
3- SpinnerCurrRow => where I have defined the object that contain photo string that will be displayed in a spinner row
4- spnrow.xml => layout of a spinner row
5- frmconfig.xml => layout of Option.java activity
Вот код:
1- http://ideone.com/8hg93
2- http://ideone.com/N8Xu4
3- http://ideone.com/VMMSX
4- http://ideone.com/mumbn
5- http://ideone.com/f69zF
Счетчик заполнен правильно, но проблема в том, что если я нажму на счетчик для выбора записи, я верну исключение NullPointException
10-07 11:12:15.813: ERROR/AndroidRuntime(996): FATAL EXCEPTION: main
10-07 11:12:15.813: ERROR/AndroidRuntime(996): java.lang.NullPointerException
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.ListView.measureScrapChild(ListView.java:1135)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.ListView.measureHeightOfChildren(ListView.java:1218)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.ListView.onMeasure(ListView.java:1127)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.View.measure(View.java:8313)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.View.measure(View.java:8313)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at com.android.internal.widget.WeightedLinearLayout.onMeasure(WeightedLinearLayout.java:60)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.View.measure(View.java:8313)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.View.measure(View.java:8313)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.View.measure(View.java:8313)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.os.Handler.dispatchMessage(Handler.java:99)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.os.Looper.loop(Looper.java:123)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at java.lang.reflect.Method.invokeNative(Native Method)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at java.lang.reflect.Method.invoke(Method.java:507)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-07 11:12:15.813: ERROR/AndroidRuntime(996): at dalvik.system.NativeStart.main(Native Method)
Я не понимаю, что я делаю неправильно.
Кто-нибудь может мне помочь?
Большое вам спасибо.
Комментарии:
1. где ваш код setOnItemSelectedListener() ? я не нашел этого в вашем коде.
2. Я не реализовал это …….как это работает?
3. Я не думаю, что это проблема ….. исключение генерируется, если я нажимаю для выбора нового значения в счетчике.