Android Open Source - AndroidCameraUtil Take Photo Activity






From Project

Back to project page AndroidCameraUtil.

License

The source code is released under:

Apache License

If you think the Android project AndroidCameraUtil listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.ecotastic.android.camerautil.sample;
/*from w ww.j  av  a 2 s .  c  om*/
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import de.ecotastic.android.camerautil.lib.CameraIntentHelperActivity;
import de.ecotastic.android.camerautil.util.BitmapHelper;

/**
 * Example Activity of how to use the CameraIntentHelperActivity
 * 
 * @author Ralf Gehrer <ralf@ecotastic.de>
 */
public class TakePhotoActivity extends CameraIntentHelperActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_take_photo);
  }
  
  public void onStartCamera(View view) {
    startCameraIntent();
  }
  
  @Override
  protected void onPhotoUriFound() {
    TextView uirView = (TextView) findViewById(R.id.activity_take_photo_image_uri);
    uirView.setText("photo uri: " + photoUri.toString());
    
    Bitmap photo = BitmapHelper.readBitmap(this, photoUri);
        if (photo != null) {
            photo = BitmapHelper.shrinkBitmap(photo, 300, rotateXDegrees);
            ImageView imageView = (ImageView) findViewById(R.id.activity_take_photo_image_view);
       imageView.setImageBitmap(photo); 
        }
    
        //Delete photo in second location (if applicable)
        if (preDefinedCameraUri != null && !preDefinedCameraUri.equals(photoUri)) {
          BitmapHelper.deleteImageWithUriIfExists(preDefinedCameraUri, this);
        }
        //Delete photo in third location (if applicable)
        if (photoUriIn3rdLocation != null) {
          BitmapHelper.deleteImageWithUriIfExists(photoUriIn3rdLocation, this);
        }
  }
  
  @Override
  protected void onPhotoUriNotFound() {
    super.onPhotoUriNotFound();
    TextView uirView = (TextView) findViewById(R.id.activity_take_photo_image_uri);
    uirView.setText("photo uri: not found");
  }
}




Java Source Code List

de.ecotastic.android.camerautil.lib.CameraIntentHelperActivity.java
de.ecotastic.android.camerautil.sample.TakePhotoActivity.java
de.ecotastic.android.camerautil.util.BitmapHelper.java
de.ecotastic.android.camerautil.util.DateParser.java