Android Open Source - android-camera-api Utility






From Project

Back to project page android-camera-api.

License

The source code is released under:

This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...

If you think the Android project android-camera-api 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 com.tanukiteam.camera.utils;
//from w  w w .  jav  a  2 s. c  om
import android.content.Context;
import android.content.res.Configuration;
import android.hardware.Camera;

/**
 * Utility class
 * @author ajuarez@tanukiteam.com
 */

public class Utility {

  /** A safe way to get an instance of the Camera object. */
  public static Camera getCameraInstance(){
      Camera c = null;
      try {
          c = Camera.open(); // attempt to get a Camera instance
      }
      catch (Exception e){
          // Camera is not available (in use or does not exist)
      }
      return c; // returns null if camera is unavailable
  }
  
  /**
   * Check if device is Tablet
   * @param Context
   * @return boolean
   */
  public static boolean isTablet(Context context) {
      return (context.getResources().getConfiguration().screenLayout
              & Configuration.SCREENLAYOUT_SIZE_MASK)
              >= Configuration.SCREENLAYOUT_SIZE_LARGE;
  }  
  
}




Java Source Code List

com.tanukiteam.camera.CameraAPIActivity.java
com.tanukiteam.camera.CameraCustomGalleryActivity.java
com.tanukiteam.camera.CameraPreview.java
com.tanukiteam.camera.utils.Utility.java
com.tanukiteam.camera.widget.CancelButton.java
com.tanukiteam.camera.widget.ConfirmButton.java