03-05 01:20:56.040: E/AndroidRuntime(1396): java.lang.NullPointerException
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.widget.PopupWindow.setContentView(PopupWindow.java:384)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.widget.PopupWindow.<init>(PopupWindow.java:286)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.widget.PopupWindow.<init>(PopupWindow.java:266)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.widget.PopupWindow.<init>(PopupWindow.java:223)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.os.Handler.handleCallback(Handler.java:587)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.os.Looper.loop(Looper.java:130)
03-05 01:20:56.040: E/AndroidRuntime(1396): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-05 01:20:56.040: E/AndroidRuntime(1396): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 01:20:56.040: E/AndroidRuntime(1396): at java.lang.reflect.Method.invoke(Method.java:507)
03-05 01:20:56.040: E/AndroidRuntime(1396): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-05 01:20:56.040: E/AndroidRuntime(1396): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-05 01:20:56.040: E/AndroidRuntime(1396): at dalvik.system.NativeStart.main(Native Method)
以上是错误信息
在重写PopupWindows的时候记得加上super(context);就行了
4.0以上不会出现这个问题