我已将zxing lib com.google/com.google.zxing.client.android.captureactivity.jar.zip(497 k)导入到我的项目中。 然后我以这种方式在我的项目中有一个imporgted BeepManager类:
import com.google.zxing.client.android.BeepManager;
private BeepManager beepManager;
beepManager = new BeepManager(activity);
在import语句之后,我有这个错误提示:
The constructor BeepManager(Activity) is not visible
编辑:
DecodeHandler(CaptureActivity activity) {
this.activity = activity;
baseApi = activity.getBaseApi();
beepManager = new BeepManager(CaptureActivity.this);
beepManager.updatePrefs();
请问可能出错......
答案 0 :(得分:0)
尝试改变这一点:
beepManager = new BeepManager(activity);
对此:
beepManager = new BeepManager(<ActivityName>.this);
编辑:问题出现了,因为您正在Class的实例上发送类标识符,您可以通过更改它来解决它:
DecodeHandler(CaptureActivity activity) {
this.activity = activity;
baseApi = activity.getBaseApi();
beepManager = new BeepManager(CaptureActivity.this);
beepManager.updatePrefs();
到
DecodeHandler(CaptureActivity activity) {
this.activity = activity;
baseApi = activity.getBaseApi();
beepManager = new BeepManager(activity);
beepManager.updatePrefs();