Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ebay.redlasersdk
Class BarcodeScanActivity

    java.lang.Object
      android.content.Context
          android.content.ContextWrapper
              android.view.ContextThemeWrapper
                  android.app.Activity
                      com.ebay.redlasersdk.BarcodeScanActivity

All Implemented Interfaces:
  android.content.ComponentCallbacks, android.content.ComponentCallbacks2, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.LayoutInflater.Factory2, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback

    public abstract class BarcodeScanActivity

extends android.app.Activity

Base barcode activity. Intended to be subclassed by client apps to implement the scanning activity. Most of the public API for the SDK is either handled or indirectly managed by this class.

Nested Class Summary
`static class` | `BarcodeScanActivity.Status` The onScanStatusUpdate() method takes a HashMap as a parameter.

Field Summary
`BarcodeTypes` | `enabledTypes` The set of enabled barcode types.
`static java.lang.String` | `PREF_ORIENTATION_LANDSCAPE` Set scan screen orientation to landscape
`static java.lang.String` | `PREF_ORIENTATION_PORTRAIT` Set scan screen orientation to portrait
`static java.lang.String` | `REDLASER_CAMERA_PREVIEW_VIEW_TAG` Used to tag a particular view in a hierarchy to be the container for the camera preview.
`static java.lang.String` | `RESULT_EXTRA` An ArrayList of everything found in the scan session, returned as extra data in the return Intent when the scanning activity completes.

Fields inherited from class android.app.Activity
`DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK`

Fields inherited from class android.content.Context
`ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NFC_SERVICE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, UI_MODE_SERVICE, USB_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE`

Fields inherited from interface android.content.ComponentCallbacks2
`TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_UI_HIDDEN`

Constructor Summary
`BarcodeScanActivity()` Default constructor.

Method Summary
`protected void` | `doneScanning()` This method ends the scan session.
`protected void` | `enabledBarcodeTypesChanged()` Called automatically when the set of enabled barcode types changes.
`java.lang.String` | `getOrientationSetting()` Override this method to request a screen orientation programmatically.
`protected android.widget.FrameLayout` | `getPreviewView()` Subclasses can override this method to indicate to the BarcodeScanActivity where in the view hierarchy the camera preview view should be placed.
`protected boolean` | `getTorch()` Returns the current state of the camera torch.
`protected boolean` | `isTorchAvailable()` Returns whether torch mode is available.
`void` | `onBackPressed()` The SDK forwards onBackPressed to doneScanning().
`void` | `onCameraError(int error)` Used to propagate camera errors to the onError method (onError is protected).
`void` | `onCameraPreviewStarted()` Performs some setup when the camera starts delivering preview images.
`void` | `onConfigurationChanged(android.content.res.Configuration config)` Called by android.app.Activity on when the device configuration changes.
`void` | `onCreate(android.os.Bundle icicle)` Called by android.app.Activity on activity creation.
`protected void` | `onDestroy()`
`protected void` | `onError(int error)` Intended to be overridden by subclasses.
`protected void` | `onPause()` Called by android.app.Activity on activity pause.
`protected void` | `onResume()` Called by android.app.Activity on activity resume--the transition to the foreground state of the activity.
`protected abstract void` | `onScanStatusUpdate(java.util.Map<java.lang.String,java.lang.Object> scanStatus)` This method is called repeatedly while scanning is active.
`protected void` | `onStart()` Called by android.app.Activity on activity start.
`protected void` | `onStop()` Called by android.app.Activity on activity stop.
`boolean` | `onTouchEvent(android.view.MotionEvent event)` Called by android.app.Activity when a touch event occurs that isn't handled by any view (such as a button).
`protected void` | `requestCameraIndex(int index)` Request a specific camera by index.
`protected void` | `requestImageData()` Calling this method during a scan session will make the SDK asynchronously gather image data and deliver it in a call to onScanStatusUpdate()--often but not always the next call.
`protected void` | `setActiveRect(android.graphics.Rect activeRect)` Sets the given rect as the engine's active rect.
`protected void` | `setTorch(boolean torchValue)` Turns the camera light on during preview.

Methods inherited from class android.app.Activity
`addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, findViewById, finish, finishActivity, finishActivityFromChild, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMenuInflater, getParent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isChangingConfigurations, isChild, isFinishing, isTaskRoot, managedQuery, moveTaskToBack, onActionModeFinished, onActionModeStarted, onActivityResult, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onChildTitleChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareOptionsMenu, onPreparePanel, onRestart, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSearchRequested, onTitleChanged, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, recreate, registerForContextMenu, removeDialog, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setIntent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, showDialog, showDialog, startActionMode, startActivities, startActivity, startActivityForResult, startActivityFromChild, startActivityFromFragment, startActivityIfNeeded, startIntentSender, startIntentSenderForResult, startIntentSenderFromChild, startManagingCursor, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu`

Methods inherited from class android.view.ContextThemeWrapper
`attachBaseContext, getTheme, setTheme`

Methods inherited from class android.content.ContextWrapper
`bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getObbDir, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, sendStickyOrderedBroadcast, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiver`

Methods inherited from class android.content.Context
`getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PREF_ORIENTATION_PORTRAIT

    public static final java.lang.String PREF_ORIENTATION_PORTRAIT

  Set scan screen orientation to portrait

  See Also:
    Constant Field Values

### PREF_ORIENTATION_LANDSCAPE

    public static final java.lang.String PREF_ORIENTATION_LANDSCAPE

  Set scan screen orientation to landscape

  See Also:
    Constant Field Values

### RESULT_EXTRA

    public static final java.lang.String RESULT_EXTRA

  An ArrayList of everything found in the scan session, returned as extra data in the return Intent when the scanning activity completes.

  See Also:
    Constant Field Values

### REDLASER_CAMERA_PREVIEW_VIEW_TAG

    public static final java.lang.String REDLASER_CAMERA_PREVIEW_VIEW_TAG

  Used to tag a particular view in a hierarchy to be the container for the camera preview. Applications should subclass BarcodeScanActivity and set up a scan overlay (by calling setContentView()) in their onCreate() method. Applications can optionally tag a view with this constant, and the SDK will set up the camera preview as a subview of the tagged view.

  If no view is tagged, and `getPreviewView()` isn't implemented or returns null, the camera preview is created as a fullscreen view behind the rest of the content.

  Using this tag is one way to achieve a non-fullscreen camera preview.

  See Also:
    `getPreviewView()`, Constant Field Values

### enabledTypes

    public BarcodeTypes enabledTypes

  The set of enabled barcode types. The SDK will only attempt to recognize the barcode types enabled in this object. You can, if necessary, change this value during a scan session.

Constructor Detail

### BarcodeScanActivity

    public BarcodeScanActivity()

  Default constructor. A few properties need to be initialized here so that they can be modified by subclasses in onCreate--particularly if they modify the property and *then* call super().

Method Detail

### onCreate

    public void onCreate(android.os.Bundle icicle)

  Called by android.app.Activity on activity creation.

  Overrides:
    `onCreate` in class `android.app.Activity`

### onStart

    protected void onStart()

  Called by android.app.Activity on activity start.

  Overrides:
    `onStart` in class `android.app.Activity`

### onStop

    protected void onStop()

  Called by android.app.Activity on activity stop.

  Overrides:
    `onStop` in class `android.app.Activity`

### onDestroy

    protected void onDestroy()

  Overrides:
    `onDestroy` in class `android.app.Activity`

### onResume

    protected void onResume()

  Called by android.app.Activity on activity resume--the transition to the foreground state of the activity.

  Overrides:
    `onResume` in class `android.app.Activity`

### onPause

    protected void onPause()

  Called by android.app.Activity on activity pause.

  Overrides:
    `onPause` in class `android.app.Activity`

### onConfigurationChanged

    public void onConfigurationChanged(android.content.res.Configuration config)

  Called by android.app.Activity on when the device configuration changes. BarcodeScanActivity overrides this method to prevent reloading the activity when the orientation changes or the keyboard is shown or hidden. Remember that your application must add a "configChanges" attribute to the scan activity in the manifest for this to work.

  Specified by:
    `onConfigurationChanged` in interface `android.content.ComponentCallbacks`
  Overrides:
    `onConfigurationChanged` in class `android.app.Activity`

### enabledBarcodeTypesChanged

    protected void enabledBarcodeTypesChanged()

  Called automatically when the set of enabled barcode types changes. You shouldn't need to call this method yourself.

### doneScanning

    protected void doneScanning()

  This method ends the scan session. Generally called by the status method in subclasses, or in a subclass button handler.

### onBackPressed

    public void onBackPressed()

  The SDK forwards onBackPressed to doneScanning(). DoneScanning() calls finish(), but also sets the result to RESULT_OK and parcels up the found barcodes.

  Overrides:
    `onBackPressed` in class `android.app.Activity`

### requestCameraIndex

    protected void requestCameraIndex(int index)

  Request a specific camera by index. The index is bounds-checked and used in the Camera.open(int) call. Does not guarantee that this camera index will be used. If the requested camera is unsuitable, fails to open, or the API level is < 9, the default camera may be opened instead. Currently, the camera index must be set before onStart() occurs, and the camera can't be changed once scanning starts.

  Parameters:
    `index` - The camera to use. 0 is the default.

### setActiveRect

    protected void setActiveRect(android.graphics.Rect activeRect)

  Sets the given rect as the engine's active rect. This function takes a rectangle in the preview coordinate system, and will use additional effort to try to find barcodes within that area.

  Parameters:
    `activeRect` - The rectangle to set, in preview coords

### requestImageData

    protected void requestImageData()

  Calling this method during a scan session will make the SDK asynchronously gather image data and deliver it in a call to onScanStatusUpdate()--often but not always the next call. The image data will be returned in the STATUS_CAMERA_SNAPSHOT key of the HashMap parameter.

  The SDK may return JPEG-compressed image data from the preview stream, or it may use the Camera's picture-taking methods to acquire JPEG data. In either case, this method is not fast enough to deliver a constant stream of preview images.

### setTorch

    protected void setTorch(boolean torchValue)

  Turns the camera light on during preview.

  Parameters:
    `torchValue` - TRUE to turn torch on.

### getTorch

    protected boolean getTorch()

  Returns the current state of the camera torch.

### isTorchAvailable

    protected boolean isTorchAvailable()

  Returns whether torch mode is available. Specifically, returns TRUE if the Camera device that was opened has FLASH_MODE_TORCH in its list of supported flash modes.

  This method will only return valid results after the Activity's onResume() method has been called. Remember that the camera that gets opened is not necessarily the camera that was requested.

  The intent of this method is to allow the application to have a 'Light' button that only appears on devices with torch mode.

### onTouchEvent

    public boolean onTouchEvent(android.view.MotionEvent event)

  Called by android.app.Activity when a touch event occurs that isn't handled by any view (such as a button). On devices that support focusing areas, a tap in the camera preview area will initiate a focus on the indicated point. On devices that support autofocus but not focusing areas, an autofocus will be initiated.

  Your application can override this method in your BarcodeScanActivity subclass if you want taps in the preview area to perform some other action.

  Overrides:
    `onTouchEvent` in class `android.app.Activity`

### onCameraPreviewStarted

    public void onCameraPreviewStarted()

  Performs some setup when the camera starts delivering preview images. Do not call this method directly.

### onCameraError

    public void onCameraError(int error)

  Used to propagate camera errors to the onError method (onError is protected). Do not call this method directly.

### onError

    protected void onError(int error)

  Intended to be overridden by subclasses. This method may be overridden by subclasses to be informed of errors that occur while scanning.

### onScanStatusUpdate

    protected abstract void onScanStatusUpdate(java.util.Map<java.lang.String,java.lang.Object> scanStatus)

  This method is called repeatedly while scanning is active. The scanStatus map contains status information about the scanning session.

  Parameters:
    `scanStatus` -

### getOrientationSetting

    public java.lang.String getOrientationSetting()

  Override this method to request a screen orientation programmatically. Default orientation is portrait.

  The BarcodeScanActivity calls this method during onCreate(). Your subclass, therefore, should ensure that this method returns the proper value before your subclass calls super.onCreate().

  Returns:
    Either PREF_ORIENTATION_LANDSCAPE or PREF_ORIENTATION_PORTRAIT.

### getPreviewView

    protected android.widget.FrameLayout getPreviewView()

  Subclasses can override this method to indicate to the BarcodeScanActivity where in the view hierarchy the camera preview view should be placed. If this method is not implemented, the camera preview will be added as a child of the root view, behind all other views, sized to the size of the screen.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 eBay Inc. All Rights Reserved.