android在PopupWindow里面,AnimationListener的AnimationEnd()方法调用dismiss(),出现错误

EXCEPTION: main
03-20 11:31:59.207: E/AndroidRuntime(20030): java.lang.NullPointerException
03-20 11:31:59.207: E/AndroidRuntime(20030):    at android.view.ViewRootImpl.drawAccessibilityFocusedDrawableIfNeeded(ViewRootImpl.java:2311)
03-20 11:31:59.207: E/AndroidRuntime(20030):    at android.view.ViewRootImpl.onHardwarePostDraw(ViewRootImpl.java:1941)


需要如下调用才行:

	@Override
	public void dismiss() {
		Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.up);
		anim.setAnimationListener(new SimpleAnimationListener() {
			@Override
			public void onAnimationStart(Animation animation) {
				if (null != mOnAnimationDismissListener)
					mOnAnimationDismissListener.onStart();
			}

			@Override
			public void onAnimationEnd(Animation animation) {
				new Handler().post(new Runnable() {
					@Override
					public void run() {
						PopWindow.super.dismiss();
					}
				});
			}
		});
		mPopView.startAnimation(anim);
	}


你可能感兴趣的:(android在PopupWindow里面,AnimationListener的AnimationEnd()方法调用dismiss(),出现错误)