[Android development experience] The NULL pointer of the init method of PopupWindow in earlier versions is abnormal. androidpopupwindow
Yesterday, the tester submitted a BUG to me. In Version 2.3, when popupwindow is popped up, there will be a null pointer exception. In the high version, there is no problem, the following error message is displayed. (the exception is the same as the one found. My exception has been resolved)
Exception information: Exception: null stack information: android. widget. popupWindow. setContentView (PopupWindow. java: 384) android. widget. popupWindow. <init> (PopupWindow. java: 286) android. widget. popupWindow. <init> (PopupWindow. java: 266) android. widget. popupWindow. <init> (PopupWindow. java: 223) net. oschina. gitapp. widget. dropDownMenu. <init> (DropDownMenu. java: 34) net. oschina. gitapp. ui. projectActivity. initMoreMenu (ProjectActivity. java: 255) net. oschina. gitapp. ui. projectActivity. access $10 (ProjectActivity. java: 254) net. oschina. gitapp. ui. projectActivity $3. onPostExecute (ProjectActivity. java: 385) net. oschina. gitapp. ui. projectActivity $3. onPostExecute (ProjectActivity. java: 1) android. OS. asyncTask. finish (AsyncTask. java: 417) android. OS. asyncTask. access $300 (AsyncTask. java: 127) android. OS. asyncTask $ InternalHandler. handleMessage (AsyncTask. java: 429) android. OS. handler. dispatchMessage (Handler. java: 99) android. OS. logoff. loop (logoff. java: 130) android. app. activityThread. main (ActivityThread. java: 3691) java. lang. reflect. method. invokeNative (Native Method) java. lang. reflect. method. invoke (Method. java: 507) com. android. internal. OS. zygoteInit $ MethodAndArgsCaller. run (ZygoteInit. java: 912) com. android. internal. OS. zygoteInit. main (ZygoteInit. java: 670) dalvik. system. nativeStart. main (Native Method)
This is because super (context) is not called in the constructor. You only need to call super (context) In the first line of the constructor.