Android Open Source - sbicktAndroid Camera Activity






From Project

Back to project page sbicktAndroid.

License

The source code is released under:

GNU General Public License

If you think the Android project sbicktAndroid 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

/**
 * #################################################
 * #            s'bickt Android Client             #
 * # Bildungseinrichtung:  Fachhochschule Salzburg #
 * #         Studiengang:  MultiMediaTechnology    #
 * #               Zweck:  Qualifikationsprojekt   #
 * #################################################
 */* w w w  . ja v  a 2  s  . c o  m*/
 * This is the client for the augmented reality and social community app s'bickt
 * Copyright Alexander Flatscher, Ismail Hanli
 * 
 * This file is part of s'bickt.
 * 
 * S'bickt is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * S'bickt is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with s'bickt.  If not, see <http://www.gnu.org/licenses/>.
 */

package geotag.example.sbickt;

import geotag.core.R;

import java.io.IOException;

import android.app.Activity;
import android.graphics.PixelFormat;
import android.hardware.Camera;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.ImageButton;


public class CameraActivity extends Activity implements SurfaceHolder.Callback {
  
  private Camera mCamera;
  private SurfaceHolder mSurfaceHolder;
  private SurfaceView mSurfaceView;
  private boolean mPreviewRunning;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFormat(PixelFormat.TRANSLUCENT);

    setContentView(R.layout.camera_view);
    
    ((ImageButton) findViewById(R.id.live_view)).setVisibility(View.INVISIBLE);
        
    mSurfaceView = (SurfaceView) findViewById(R.id.surface);
    
    mSurfaceHolder = mSurfaceView.getHolder();
    mSurfaceHolder.addCallback(this);
    mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  }

  public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
    if(mPreviewRunning)
      mCamera.stopPreview();
    
    Camera.Parameters p = mCamera.getParameters();
    //p.setPreviewSize(width, height);
    mCamera.setParameters(p);
    
    try {
      mCamera.setPreviewDisplay(mSurfaceHolder);
    } catch (IOException e) {
      e.printStackTrace();
    }
    
    mCamera.startPreview();
    mPreviewRunning = true;
    
  }

  public void surfaceCreated(SurfaceHolder holder) {
    mCamera = Camera.open();
    
  }

  public void surfaceDestroyed(SurfaceHolder holder) {
    mCamera.stopPreview();
    mPreviewRunning = false;
    mCamera.release();
    
  }
  
}




Java Source Code List

geotag.core.GeoTag.java
geotag.core.HttpHelper.java
geotag.core.KmlParser.java
geotag.core.Point3D.java
geotag.core.Properties.java
geotag.core.TagVisibility.java
geotag.example.sbickt.ArchiveActivity.java
geotag.example.sbickt.BackgroundView.java
geotag.example.sbickt.BicksActivity.java
geotag.example.sbickt.CameraActivity.java
geotag.example.sbickt.FriendsActivity.java
geotag.example.sbickt.MapViewActivity.java
geotag.example.sbickt.MenuView.java
geotag.example.sbickt.ProfileActivity.java
geotag.example.sbickt.SbicktAPI.java
geotag.example.sbickt.SbicktMessagesOverlay.java