CameraExample
0.1
|
This Application uses the Camera API to select and take pictures and video. More...
Public Member Functions | |
boolean | onCreateOptionsMenu (Menu menu) |
Inflate the menu; this adds items to the action bar if it is present. More... | |
boolean | onOptionsItemSelected (MenuItem item) |
Handles menu item selection. More... | |
Protected Member Functions | |
void | onCreate (Bundle savedInstanceState) |
Method called when activity is created. Sets the content view to activity_main or activity_main_landscape, depending on orientation. More... | |
void | dispatchSelectImageIntent () |
Start the intent to select an image. More... | |
void | dispatchSelectVideoIntent () |
Start the intent to select an video. More... | |
void | dispatchTakePictureIntent () |
Start the intent take a picture with the camera. More... | |
File | createImageFile () throws IOException |
Create a .jpg file to hold the image. More... | |
void | dispatchTakeVideoIntent (int videoQuality) |
Start the intent take a video with the camera. More... | |
File | createVideoFile (int videoQuality) throws IOException |
Create a .jpg file to hold the image. More... | |
void | onSaveInstanceState (Bundle outState) |
Here we store the file url as it will be null after returning from camera app. More... | |
void | onRestoreInstanceState (Bundle savedInstanceState) |
Here we restore the fileUri again. More... | |
void | rotateAndSetImage (ImageView imageView, String path) |
Rotate the image to always be in portrait mode. Workaround needed for some Androids. More... | |
void | onActivityResult (int requestCode, int resultCode, Intent data) |
Work with results of activity. More... | |
Private Attributes | |
Uri | mediaUri |
This contains the uri of the newly taken picture or video. More... | |
VideoView | videoView |
The associated VideoView for this activity. More... | |
ImageView | imageView |
The associated imageView for this activity. More... | |
TextView | videoTextView |
Information for the videoView. More... | |
TextView | imageTextView |
Static Private Attributes | |
static final int | IMAGE_REQUEST_CODE = 1 |
static final int | REQUEST_IMAGE_CAPTURE = 2 |
static final int | REQUEST_VIDEO_CAPTURE = 3 |
static final int | VIDEO_REQUEST_CODE = 4 |
static final int | LOW_QUALITY_VIDEO = 0 |
static final int | HIGH_QUALITY_VIDEO = 1 |
static final String | IMAGE_DIRECTORY ="images" |
static final String | VIDEO_DIRECTORY ="videos" |
This Application uses the Camera API to select and take pictures and video.
Definition at line 35 of file MainActivity.java.
|
protected |
Create a .jpg file to hold the image.
Definition at line 289 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.IMAGE_DIRECTORY.
Referenced by edu.clemson.cameraexample.MainActivity.dispatchTakePictureIntent().
|
protected |
Create a .jpg file to hold the image.
videoQuality | High or low quality video |
Definition at line 364 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.LOW_QUALITY_VIDEO, and edu.clemson.cameraexample.MainActivity.VIDEO_DIRECTORY.
Referenced by edu.clemson.cameraexample.MainActivity.dispatchTakeVideoIntent().
|
protected |
Start the intent to select an image.
See more about working with an image picker from http://www.vogella.com/tutorials/AndroidCamera/article.html
Definition at line 203 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.IMAGE_REQUEST_CODE.
Referenced by edu.clemson.cameraexample.MainActivity.onOptionsItemSelected().
|
protected |
Start the intent to select an video.
See more about working with an image picker from http://www.vogella.com/tutorials/AndroidCamera/article.html
Definition at line 224 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.VIDEO_REQUEST_CODE.
Referenced by edu.clemson.cameraexample.MainActivity.onOptionsItemSelected().
|
protected |
Start the intent take a picture with the camera.
Started with this http://developer.android.com/training/camera/photobasics.html But ran into this problem http://stackoverflow.com/questions/13912095/java-lang-nullpointerexception-on-bundle-extras-data-getextras If a new picture or video is saved to an external file and not to the gallery, then the data returned from the intent will be null. Therefore, the uri information must be stored in an instance variable.
Definition at line 246 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.createImageFile(), edu.clemson.cameraexample.MainActivity.mediaUri, and edu.clemson.cameraexample.MainActivity.REQUEST_IMAGE_CAPTURE.
Referenced by edu.clemson.cameraexample.MainActivity.onOptionsItemSelected().
|
protected |
Start the intent take a video with the camera.
videoQuality | LOW_QUALITY_VIDEO or HIGH_QUALITY_VIDEO |
Started with this http://developer.android.com/training/camera/photobasics.html But ran into this problem http://stackoverflow.com/questions/13912095/java-lang-nullpointerexception-on-bundle-extras-data-getextras If a new picture or video is saved to an external file and not to the gallery, then the data returned from the intent will be null. Therefore, the uri information must be stored in an instance variable.
Definition at line 313 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.createVideoFile(), edu.clemson.cameraexample.MainActivity.mediaUri, and edu.clemson.cameraexample.MainActivity.REQUEST_VIDEO_CAPTURE.
Referenced by edu.clemson.cameraexample.MainActivity.onOptionsItemSelected().
|
protected |
Work with results of activity.
requestCode | Request Code sent to activity |
resultCode | Result Code returned to activity |
data | Data associated with the intent that called this activity. |
Big catchall for all the result of all the activities that can be launched by this activity. Action is determined by requestCode and resultCode.
Creating thumbnails for video: http://android-er.blogspot.com/2011/05/create-thumbnail-for-video-using.html
Fixed null pointer exceptions from - http://www.androidhive.info/2013/09/android-working-with-camera-api/
Fixed null pointer exceptions from - http://www.androidhive.info/2013/09/android-working-with-camera-api/
Creating thumbnails for video: http://android-er.blogspot.com/2011/05/create-thumbnail-for-video-using.html
Definition at line 473 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.IMAGE_REQUEST_CODE, edu.clemson.cameraexample.MainActivity.mediaUri, edu.clemson.cameraexample.MainActivity.REQUEST_IMAGE_CAPTURE, edu.clemson.cameraexample.MainActivity.REQUEST_VIDEO_CAPTURE, and edu.clemson.cameraexample.MainActivity.VIDEO_REQUEST_CODE.
|
protected |
Method called when activity is created. Sets the content view to activity_main or activity_main_landscape, depending on orientation.
savedInstanceState |
Information about VideoView http://www.techotopia.com/index.php/Implementing_Video_Playback_on_Android_using_the_VideoView_and_MediaController_Classes
http://stackoverflow.com/questions/3686729/mediacontroller-positioning-over-videoview
Definition at line 100 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.imageTextView, edu.clemson.cameraexample.MainActivity.imageView, edu.clemson.cameraexample.MainActivity.videoTextView, and edu.clemson.cameraexample.MainActivity.videoView.
public boolean edu.clemson.cameraexample.MainActivity.onCreateOptionsMenu | ( | Menu | menu | ) |
Inflate the menu; this adds items to the action bar if it is present.
menu | Menu to be created. |
Definition at line 146 of file MainActivity.java.
public boolean edu.clemson.cameraexample.MainActivity.onOptionsItemSelected | ( | MenuItem | item | ) |
Handles menu item selection.
item | MenuItem that was selected |
Definition at line 161 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.dispatchSelectImageIntent(), edu.clemson.cameraexample.MainActivity.dispatchSelectVideoIntent(), edu.clemson.cameraexample.MainActivity.dispatchTakePictureIntent(), edu.clemson.cameraexample.MainActivity.dispatchTakeVideoIntent(), edu.clemson.cameraexample.MainActivity.HIGH_QUALITY_VIDEO, and edu.clemson.cameraexample.MainActivity.LOW_QUALITY_VIDEO.
|
protected |
Here we restore the fileUri again.
See #11 at: http://www.androidhive.info/2013/09/android-working-with-camera-api/
Definition at line 415 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.mediaUri.
|
protected |
Here we store the file url as it will be null after returning from camera app.
See #11 at: http://www.androidhive.info/2013/09/android-working-with-camera-api/
Definition at line 401 of file MainActivity.java.
References edu.clemson.cameraexample.MainActivity.mediaUri.
|
protected |
Rotate the image to always be in portrait mode. Workaround needed for some Androids.
Rotating images from http://www.higherpass.com/Android/Tutorials/Working-With-Images-In-Android/3/
Rotating images from http://www.higherpass.com/Android/Tutorials/Working-With-Images-In-Android/3/
Definition at line 428 of file MainActivity.java.
|
staticprivate |
Definition at line 46 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.onOptionsItemSelected().
|
staticprivate |
Definition at line 50 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.createImageFile().
|
staticprivate |
Definition at line 39 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.dispatchSelectImageIntent(), and edu.clemson.cameraexample.MainActivity.onActivityResult().
|
private |
Definition at line 88 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.onCreate().
|
private |
The associated imageView for this activity.
Definition at line 74 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.onCreate().
|
staticprivate |
Definition at line 45 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.createVideoFile(), and edu.clemson.cameraexample.MainActivity.onOptionsItemSelected().
|
private |
This contains the uri of the newly taken picture or video.
I started with the tutorial at http://developer.android.com/training/camera/photobasics.html, but ran into this problem http://stackoverflow.com/questions/13912095/java-lang-nullpointerexception-on-bundle-extras-data-getextras If a new picture or video is saved to an external file and not to the gallery, then the data returned from the intent will be null. Therefore, the uri information must be stored in an instance variable.
Definition at line 62 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.dispatchTakePictureIntent(), edu.clemson.cameraexample.MainActivity.dispatchTakeVideoIntent(), edu.clemson.cameraexample.MainActivity.onActivityResult(), edu.clemson.cameraexample.MainActivity.onRestoreInstanceState(), and edu.clemson.cameraexample.MainActivity.onSaveInstanceState().
|
staticprivate |
Definition at line 40 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.dispatchTakePictureIntent(), and edu.clemson.cameraexample.MainActivity.onActivityResult().
|
staticprivate |
Definition at line 41 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.dispatchTakeVideoIntent(), and edu.clemson.cameraexample.MainActivity.onActivityResult().
|
staticprivate |
Definition at line 51 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.createVideoFile().
|
staticprivate |
Definition at line 42 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.dispatchSelectVideoIntent(), and edu.clemson.cameraexample.MainActivity.onActivityResult().
|
private |
Information for the videoView.
Definition at line 81 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.onCreate().
|
private |
The associated VideoView for this activity.
Definition at line 68 of file MainActivity.java.
Referenced by edu.clemson.cameraexample.MainActivity.onCreate().