Code example for Camera

Methods: getParametersreleasesetErrorCallbacksetParameterssetPreviewDisplay

0
    public boolean initCamera() { 
    	releaseCamera(); 
    	 
    	try { 
    		c = Camera.open();
    		c.setErrorCallback(errorCallback);
        } catch (RuntimeException e) {
			Log.v(TAG, "Error initializing camera (runtime)");
			e.printStackTrace();
			releaseCamera(); 
			return false;        	 
        } 
         
    	if (c==null) {
    		Log.v(TAG, "Could not open camera");
    		return false; 
    	} 
    	 
        try { 
        	Log.v(TAG, "Init. camera h="+h.isCreating());
 
            Camera.Parameters p;
            p = c.getParameters();
            p.set("antibanding", "off");           
            //p.set("effect", "mono"); 
            p.set("jpeg-quality", 100);
            //p.set("luma-adjust", 1); 
            p.set("nightshot-mode", 1);
            p.set("rotation", 0);
            //p.set("whitebalance", "twilight"); 
            p.set("picture-size", "2048x1536");
            p.set("picture-format", "jpeg");
            c.setParameters(p);
			c.setPreviewDisplay(h);
		} catch (IOException e) {
			Log.v(TAG, "Error initializing camera (io)");
			e.printStackTrace();
			releaseCamera(); 
			return false; 
		}    	   
		 
		return true; 
    } 
     
     
    /** 
     *  
     */ 
    public void releaseCamera() { 
    	if ( c != null )
    		c.release();
    	c = null;
    } 
     
     
    /**