首页 > 代码库 > android popupwindow低版本报空指针
android popupwindow低版本报空指针
在项目中使用Popupwindow pop=new?Popupwindow();在2.3版本报
异常信息: Exception: null 堆栈信息: 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.Looper.loop(Looper.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)
只需使用?Popupwindow pop=new?Popupwindow(Context); 方法替换即可
android popupwindow低版本报空指针