Devester
Devester

Reputation: 1183

zxing barcode - how to embed the scanner(intent) with other layouts

The code below works for me. However, how could I embed it with other layouts from another activity?

Basically, The screen will be splitted in two parts: Fist one will contain a header and shared buttons to use in other screens; Second one will be the Barcode scanner or any other screen.

public Button.OnClickListener mScan = new Button.OnClickListener() {
public void onClick(View v) {
    Intent intent = new Intent("com.google.zxing.client.android.SCAN");
    intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
    startActivityForResult(intent, 0);
}

};

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
    if (resultCode == RESULT_OK) {
        String contents = intent.getStringExtra("SCAN_RESULT");
        String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
        // Handle successful scan
    } else if (resultCode == RESULT_CANCELED) {
        // Handle cancel
    }
}

}

thanks

Upvotes: 1

Views: 629

Answers (1)

Sean Owen
Sean Owen

Reputation: 66886

There isn no way to do this. You are invoking a third-party app and can't control how it looks.

Upvotes: 4

Related Questions