Advertisement
vyoumans

Untitled

Dec 31st, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. 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.
  2. the question is... how do I return to the fragment that was active when the QRCOde scan was called?
  3.  
  4. thanks
  5.  
  6.  
  7.  
  8.  
  9.  
  10. //==================================================================
  11. //Step 02 - getBINID
  12. //====================================================================================
  13.  
  14. public void btnClickZZF_Step02_ScanBinID (View view){
  15. btnZZZF_Stp2_SCAN01();
  16. }
  17.  
  18.  
  19. public void btnZZZF_Stp2_SCAN01 (){
  20.  
  21. Intent intent = new Intent("com.google.zxing.client.android.SCAN");
  22. //intent.putExtra("SCAN_MODE", "PRODUCT_MODE");//for Qr code, its "QR_CODE_MODE" instead of "PRODUCT_MODE"
  23. intent.putExtra("SCAN_MODE", "QR_CODE_MODE");//for Qr code, its "QR_CODE_MODE" instead of "PRODUCT_MODE"
  24. intent.putExtra("SAVE_HISTORY", false);//this stops saving ur barcode in barcode scanner app's history
  25. startActivityForResult(intent, 0);
  26. }
  27.  
  28.  
  29. @Override
  30. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  31. super.onActivityResult(requestCode, resultCode, data);
  32. if (requestCode == 0) {
  33. if (resultCode == RESULT_OK) {
  34. String contents = data.getStringExtra("SCAN_RESULT"); //this is the result
  35.  
  36. Log.d("In ZZF S02", "-------------------------------------------");
  37. Log.d("Contents = ", contents);
  38. // content is working and returning fine.
  39.  
  40. //TextView tvtest000 = (TextView) findViewById(R.id.tvBINID);
  41. //tvtest000.setText(contents);
  42. //tvtest000.setBackgroundColor(Color.GREEN);
  43.  
  44. //TextView tvTBINDID = (TextView) findViewById(R.id.tvBINID);
  45. //tvTBINDID.setText(contents);
  46. //tvTBINDID.setBackgroundColor(Color.GREEN);
  47.  
  48. BINID = contents;
  49.  
  50. //Button btnst01a = (Button) findViewById(R.id.btnStep1_submit);
  51. //btnst01.setEnabled(true);
  52.  
  53.  
  54. }
  55. else if (resultCode == RESULT_CANCELED) {
  56. // Handle cancel
  57. //Button btnst01 = (Button) findViewById(R.id.btnStep1_submit);
  58. //btnst01.setEnabled(false);
  59. }
  60. }
  61. }
  62.  
  63. public void FixDisplayStep02(){
  64.  
  65. setContentView(R.layout.fragment_zzf__v01__s02);
  66. TextView tvTBINDID = (TextView) findViewById(R.id.tvBINID);
  67. tvTBINDID.setText(BINID);
  68. tvTBINDID.setBackgroundColor(Color.GREEN);
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement