Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I have an intent with about 10 Fragments. Its kind of a staged question air. One of the stages ( Stage 2) does a QRCode scan. The scan works, but when returning from the scanning intent, It takes me back to the very first Fragment. this is my code. I added a public void FixDisplayStep02() {}, at the end of the code, I was thinking that perhaps I need to reset the fragment to the stage 2 frag.
- the question is... how do I return to the fragment that was active when the QRCOde scan was called?
- thanks
- //==================================================================
- //Step 02 - getBINID
- //====================================================================================
- public void btnClickZZF_Step02_ScanBinID (View view){
- btnZZZF_Stp2_SCAN01();
- }
- public void btnZZZF_Stp2_SCAN01 (){
- Intent intent = new Intent("com.google.zxing.client.android.SCAN");
- //intent.putExtra("SCAN_MODE", "PRODUCT_MODE");//for Qr code, its "QR_CODE_MODE" instead of "PRODUCT_MODE"
- intent.putExtra("SCAN_MODE", "QR_CODE_MODE");//for Qr code, its "QR_CODE_MODE" instead of "PRODUCT_MODE"
- intent.putExtra("SAVE_HISTORY", false);//this stops saving ur barcode in barcode scanner app's history
- startActivityForResult(intent, 0);
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == 0) {
- if (resultCode == RESULT_OK) {
- String contents = data.getStringExtra("SCAN_RESULT"); //this is the result
- Log.d("In ZZF S02", "-------------------------------------------");
- Log.d("Contents = ", contents);
- // content is working and returning fine.
- //TextView tvtest000 = (TextView) findViewById(R.id.tvBINID);
- //tvtest000.setText(contents);
- //tvtest000.setBackgroundColor(Color.GREEN);
- //TextView tvTBINDID = (TextView) findViewById(R.id.tvBINID);
- //tvTBINDID.setText(contents);
- //tvTBINDID.setBackgroundColor(Color.GREEN);
- BINID = contents;
- //Button btnst01a = (Button) findViewById(R.id.btnStep1_submit);
- //btnst01.setEnabled(true);
- }
- else if (resultCode == RESULT_CANCELED) {
- // Handle cancel
- //Button btnst01 = (Button) findViewById(R.id.btnStep1_submit);
- //btnst01.setEnabled(false);
- }
- }
- }
- public void FixDisplayStep02(){
- setContentView(R.layout.fragment_zzf__v01__s02);
- TextView tvTBINDID = (TextView) findViewById(R.id.tvBINID);
- tvTBINDID.setText(BINID);
- tvTBINDID.setBackgroundColor(Color.GREEN);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement