In my app there is a scanner "zxing". I need to after the scan is opened "activity_scanner".
Code scanner:
public class ScannerActivity extends AppCompatActivity { static final String ACTION_SCAN = "com.google.zxing.client.android.SCAN"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R. layout.activity_scanner); } /*Start the qr code scanner:*/ public void scanQR(View v) { try { /*Start the transition to com.google.zxing.client.android.SCAN through intent:*/ Intent intent = new Intent(ACTION_SCAN); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, 0); } catch (ActivityNotFoundException anfe) { /*It is possible to download from Play Market:*/ showDialog(ScannerActivity.this "Scanner not found", "to Install the scanner from Play Market?", "Yes", "No").show(); } } /*alert dialog to access the app download of scanner:*/ private static AlertDialog showDialog(final Activity act, CharSequence title, CharSequence message,CharSequence buttonYes, CharSequence buttonNo) { AlertDialog.Builder downloadDialog = new AlertDialog.Builder(act); downloadDialog.setTitle(title); downloadDialog.setMessage(message); downloadDialog.setPositiveButton(buttonYes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { /*Link the search request to download the app:*/ Uri uri = Uri.parse("market://search?q=pname:" + "com.google.zxing.client.android"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); try { act.startActivity(intent); } catch (ActivityNotFoundException anfe) { } } }); downloadDialog.setNegativeButton(buttonNo, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { } }); return downloadDialog.show(); } /*Process the result obtained from the application of the scanner:*/ public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == RESULT_OK) { /*Get the data after operation of the scanner and display them in Toast the message:*/ String contents = intent.getStringExtra("SCAN_RESULT"); String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); Toast toast = Toast.makeText(this, "Content:" + contents + "Format:" + format, Toast.LENGTH_LONG); toast.show(); startActivity(intent); } } } }
"activity_scanner":