org.cyberlab.activity.local
Class AbstractGeneralActivity<E>

java.lang.Object
  extended by Activity
      extended by org.cyberlab.activity.local.AbstractGeneralActivity<E>
Type Parameters:
E - The type of the class extending this.
Direct Known Subclasses:
AbstractCreateModelActivity

public abstract class AbstractGeneralActivity<E>
extends Activity

Abstract class implementing common features needed by activities using the framework. ie. starting camera and fetching image from image library. The class use Generics allowing common handling of classes that extend this.

Author:
Mats-Gøran Karlsen

Field Summary
protected static int CAMERA_ACTIVITY
           
protected static int DIALOG
           
protected  boolean externalActivity
           
protected static int LIBRARY_ACTIVITY
           
protected  java.io.File mCameraFile
           
protected  Handler mHandler
          Activity message handler.
 
Constructor Summary
AbstractGeneralActivity()
           
 
Method Summary
protected abstract  void cameraActivityResult()
          Implement this method to handle the camera result.
 Handler getHandler()
          Activity message handler.
protected abstract  void libraryActivityResult()
          Implement this method to handle the result from picking an image from the devices built-in image library.
protected  void onActivityResult(int requestCode, int resultCode, Intent data)
           
protected  void onCreate(Bundle savedInstanceState)
           
protected  void onSaveInstanceState(Bundle outState)
           
protected  void startCameraActivity()
          Start camera activity
protected  void startImageLibraryActivity()
          Start library activity
abstract  void threadFinished(int id)
          Threads notifies the activity when they finish.
protected abstract  void updateDialog(int id, Bundle args)
          Update a dialog.
protected  void updateDialogMessage(ProgressDialog dialog, java.lang.CharSequence message)
          Updates message of dialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAMERA_ACTIVITY

protected static final int CAMERA_ACTIVITY
See Also:
Constant Field Values

LIBRARY_ACTIVITY

protected static final int LIBRARY_ACTIVITY
See Also:
Constant Field Values

DIALOG

protected static final int DIALOG
See Also:
Constant Field Values

mHandler

protected final Handler mHandler
Activity message handler. Used by threads to update dialogs. Calls updateDialog with id = DIALOG (int=1234)


mCameraFile

protected java.io.File mCameraFile

externalActivity

protected boolean externalActivity
Constructor Detail

AbstractGeneralActivity

public AbstractGeneralActivity()
Method Detail

getHandler

public Handler getHandler()
Activity message handler. This is used by threads to update the progress dialog.

Returns:
Message handler

threadFinished

public abstract void threadFinished(int id)
Threads notifies the activity when they finish. This allows the activity to update itself to thread events

Parameters:
id - Thread id

cameraActivityResult

protected abstract void cameraActivityResult()
Implement this method to handle the camera result. The image returned is stored in the mCameraFile variable.


libraryActivityResult

protected abstract void libraryActivityResult()
Implement this method to handle the result from picking an image from the devices built-in image library.


updateDialog

protected abstract void updateDialog(int id,
                                     Bundle args)
Update a dialog. Used by mHandler. mHandler sends update using static DIALOG.

Parameters:
id - of dialog
args - Message to dialog

onActivityResult

protected void onActivityResult(int requestCode,
                                int resultCode,
                                Intent data)

onCreate

protected void onCreate(Bundle savedInstanceState)

onSaveInstanceState

protected void onSaveInstanceState(Bundle outState)

startCameraActivity

protected void startCameraActivity()
Start camera activity


startImageLibraryActivity

protected void startImageLibraryActivity()
Start library activity


updateDialogMessage

protected void updateDialogMessage(ProgressDialog dialog,
                                   java.lang.CharSequence message)
Updates message of dialog

Parameters:
dialog - The dialog to update
message - The new message