daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  2.     if (resultCode == RESULT_OK) {
  3.         if (requestCode == HISTORY_REQUEST_CODE) {
  4.  
  5.             int itemNumber = intent.getIntExtra(Intents.History.ITEM_NUMBER, -1);
  6.  
  7.             if (itemNumber >= 0) {
  8.                 HistoryItem historyItem = historyManager.buildHistoryItem(itemNumber);            
  9.                 decodeOrStoreSavedBitmap(null, historyItem.getResult());
  10.             }
  11.         }
  12.     }
  13. }
  14.  
  15.  
  16. if (Intents.Scan.ACTION.equals(action)) { // Scan the formats the intent requested, and   return the result to the calling activity
  17.     source = IntentSource.NATIVE_APP_INTENT;
  18.  
  19.     decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);
  20.     if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) {
  21.  
  22.         int width = intent.getIntExtra(Intents.Scan.WIDTH, 0);
  23.         int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0);
  24.  
  25.         if (width > 0 && height > 0) {
  26.             cameraManager.setManualFramingRect(width, height);
  27.         }
  28.     }
  29. }
  30.    
  31. IntentIntegrator integrator = new IntentIntegrator(yourActivity);
  32. integrator.initiateScan();
  33.    
  34. public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  35.     IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
  36.         if (scanResult != null) {
  37.             // handle scan result
  38.             //here is where you would get the data from the scanResult
  39.             //and store locally by writing to a file or however you
  40.             //intend to store it
  41.         }
  42.         // else continue with any other code you need in the method
  43. }
  44.    
  45. public void handleDecode(Result rawResult, Bitmap barcode) {
  46. inactivityTimer.onActivity();
  47. lastResult = rawResult;
  48. Log.d("last result", "checking if raw result is what i expect");
  49. System.out.println(lastResult);
  50. ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
  51. historyManager.addHistoryItem(rawResult, resultHandler);
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top