抱歉我的英语不好,这就是交易,我正在努力使用ZXingScanner Library调整QR码扫描器,但我有这个问题。
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
first of all, send the context to the second one which extends to Mainactivity.
Mainactivity
//cast floatingbutton
FloatingButton = (FloatingActionButton) findViewById(R.id.A1);
View.OnClickListener l = new Eventoqr(this);
FloatingButton.setOnClickListener(l);
Eventoqr class
public class Eventoqr extends MainActivity implements View.OnClickListener, ZXingScannerView.ResultHandler
//method that implements start camera
public void QRscan(View vista)
{
Log.e("Inicio de camara", cntx.toString());
MyscannerView = new ZXingScannerView(cntx);
setContentView(MyscannerView); /* Error generates here
}
I hope someone can help me whit this, thanks any way.
答案 0 :(得分:0)
显然,您的android.view.Window
是null
,您是否可以在代码中提供此调用?