Android 如何在AlertDialog上显示surfaceview

Android 如何在AlertDialog上显示surfaceview,android,android-alertdialog,surfaceview,Android,Android Alertdialog,Surfaceview,我正在尝试在AlertDialog上实现SurfaceView,但遇到此错误 error: incompatible types: <anonymous OnClickListener> cannot be converted to Callback 任何帮助都将不胜感激使用此 surfaceHolder.addCallback(LoginActivity.this); Toast.makeText(LoginActivity.this, "Cancel clicked", Toa

我正在尝试在AlertDialog上实现SurfaceView,但遇到此错误

error: incompatible types: <anonymous OnClickListener> cannot be converted to Callback
任何帮助都将不胜感激使用此

surfaceHolder.addCallback(LoginActivity.this);
Toast.makeText(LoginActivity.this, "Cancel clicked", Toast.LENGTH_SHORT).show();
而不是这个

surfaceHolder.addCallback(this);
Toast.makeText(getBaseContext(), "Cancel clicked", Toast.LENGTH_SHORT).show();

谢谢你的快速回复现在一切正常
surfaceHolder.addCallback(this);
Toast.makeText(getBaseContext(), "Cancel clicked", Toast.LENGTH_SHORT).show();