私はAndroidアプリケーションを書いていますが、クライアントにはバーコードスキャナーが必要です。彼らはそれについて本当に具体的であるため、彼らが望むレイアウトは次のようになります。
qrコードが見つかった場合、自動的に別のウィンドウにジャンプします。手動で押すと、手動で入力してアプリの残りの部分に進むように求められます。
つまり、基本的にはzxingコードをアプリに埋め込んでアクティビティに追加することはできますが、それは望ましくなく、別のアプリとして使用したいと考えています。
私が現在持っているのは、次のような別のアクティビティです。
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.initiateScan();
私もこれを試しました:
IntentIntegrator intentIntegrator = new IntentIntegrator(this);
Intent i = intentIntegrator.initiateCustomScan();
LocalActivityManager mgr = getLocalActivityManager();
Window w = mgr.startActivity("unique_per_activity_string", i);
View wd = w != null ? w.getDecorView() : null;
if(wd != null) {
scanButton.addView(wd);
}
しかし、その後、java.lang.SecurityExceptionが発生します。
03-19 12:22:55.890: E/AndroidRuntime(29394): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.menucard.barcode.scan/com.barcode.scan.ScanActivity}: java.lang.SecurityException: Requesting code from com.google.zxing.client.android (with uid 10139) to be run in process com.menucard.barcode.scan (with uid 10169)
誰かが私のアクティビティに別のアプリを追加する方法を知っているかもしれませんか?またはこれを達成する他の方法は?