Android自定义微调器行(照片+字符串)

时间:2011-10-07 12:34:51

标签: android spinner adapter android-spinner

我有这些文件:

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

spinner已正确填充,但问题是如果我点击微调器选择一条记录我返回了一个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)

我不知道我做错了什么。 谁能帮我? 非常感谢你。

0 个答案:

没有答案