com.google.zxing.client.android
Class CaptureActivity

java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.view.ContextThemeWrapper
              extended by android.app.Activity
                  extended by com.google.zxing.client.android.CaptureActivity
All Implemented Interfaces:
android.content.ComponentCallbacks, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.SurfaceHolder.Callback, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback

public final class CaptureActivity
extends android.app.Activity
implements android.view.SurfaceHolder.Callback

This activity opens the camera and does the actual scanning on a background thread. It draws a viewfinder to help the user place the barcode correctly, shows feedback as the image processing is happening, and then overlays the results when a scan is successful.

Author:
dswitkin@google.com (Daniel Switkin), Sean Owen

Field Summary
static int HISTORY_REQUEST_CODE
           
 
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_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_NOT_FOREGROUND, 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_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NFC_SERVICE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, UI_MODE_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Constructor Summary
CaptureActivity()
           
 
Method Summary
 void drawViewfinder()
           
 android.os.Handler getHandler()
           
 void handleDecode(Result rawResult, android.graphics.Bitmap barcode)
          A valid barcode has been found, so give an indication of success and show the results.
 void onActivityResult(int requestCode, int resultCode, android.content.Intent intent)
           
 void onCreate(android.os.Bundle icicle)
           
 boolean onCreateOptionsMenu(android.view.Menu menu)
           
protected  void onDestroy()
           
 boolean onKeyDown(int keyCode, android.view.KeyEvent event)
           
 boolean onOptionsItemSelected(android.view.MenuItem item)
           
protected  void onPause()
           
 boolean onPrepareOptionsMenu(android.view.Menu menu)
           
protected  void onResume()
           
 void restartPreviewAfterDelay(long delayMS)
           
 void surfaceChanged(android.view.SurfaceHolder holder, int format, int width, int height)
           
 void surfaceCreated(android.view.SurfaceHolder holder)
           
 void surfaceDestroyed(android.view.SurfaceHolder holder)
           
 
Methods inherited from class android.app.Activity
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchKeyEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, finish, finishActivity, finishActivityFromChild, finishFromChild, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getInstanceCount, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLocalClassName, getMenuInflater, getParent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, getWindow, getWindowManager, hasWindowFocus, isChild, isFinishing, isTaskRoot, managedQuery, moveTaskToBack, onApplyThemeResource, onAttachedToWindow, onBackPressed, onChildTitleChanged, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onDetachedFromWindow, onKeyLongPress, onKeyMultiple, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNewIntent, onOptionsMenuClosed, onPanelClosed, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPreparePanel, onRestart, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSearchRequested, onStart, onStop, onTitleChanged, onTouchEvent, onTrackballEvent, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, openContextMenu, openOptionsMenu, overridePendingTransition, registerForContextMenu, removeDialog, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setIntent, setPersistent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, showDialog, showDialog, startActivity, startActivityForResult, startActivityFromChild, 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, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getWallpaper, grantUriPermission, isRestricted, openFileInput, openFileOutput, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HISTORY_REQUEST_CODE

public static final int HISTORY_REQUEST_CODE
See Also:
Constant Field Values
Constructor Detail

CaptureActivity

public CaptureActivity()
Method Detail

getHandler

public android.os.Handler getHandler()

onCreate

public void onCreate(android.os.Bundle icicle)
Overrides:
onCreate in class android.app.Activity

onResume

protected void onResume()
Overrides:
onResume in class android.app.Activity

onPause

protected void onPause()
Overrides:
onPause in class android.app.Activity

onDestroy

protected void onDestroy()
Overrides:
onDestroy in class android.app.Activity

onKeyDown

public boolean onKeyDown(int keyCode,
                         android.view.KeyEvent event)
Specified by:
onKeyDown in interface android.view.KeyEvent.Callback
Overrides:
onKeyDown in class android.app.Activity

onCreateOptionsMenu

public boolean onCreateOptionsMenu(android.view.Menu menu)
Overrides:
onCreateOptionsMenu in class android.app.Activity

onPrepareOptionsMenu

public boolean onPrepareOptionsMenu(android.view.Menu menu)
Overrides:
onPrepareOptionsMenu in class android.app.Activity

onOptionsItemSelected

public boolean onOptionsItemSelected(android.view.MenuItem item)
Overrides:
onOptionsItemSelected in class android.app.Activity

onActivityResult

public void onActivityResult(int requestCode,
                             int resultCode,
                             android.content.Intent intent)
Overrides:
onActivityResult in class android.app.Activity

surfaceCreated

public void surfaceCreated(android.view.SurfaceHolder holder)
Specified by:
surfaceCreated in interface android.view.SurfaceHolder.Callback

surfaceDestroyed

public void surfaceDestroyed(android.view.SurfaceHolder holder)
Specified by:
surfaceDestroyed in interface android.view.SurfaceHolder.Callback

surfaceChanged

public void surfaceChanged(android.view.SurfaceHolder holder,
                           int format,
                           int width,
                           int height)
Specified by:
surfaceChanged in interface android.view.SurfaceHolder.Callback

handleDecode

public void handleDecode(Result rawResult,
                         android.graphics.Bitmap barcode)
A valid barcode has been found, so give an indication of success and show the results.

Parameters:
rawResult - The contents of the barcode.
barcode - A greyscale bitmap of the camera data which was decoded.

restartPreviewAfterDelay

public void restartPreviewAfterDelay(long delayMS)

drawViewfinder

public void drawViewfinder()