package com.apress.proandroidmedia.ch2.timersnapshot;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
import android.app.Activity;
import android.content.ContentValues;
import android.content.res.Configuration;
import android.hardware.Camera;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore.Images.Media;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class TimerSnapShot extends Activity implements OnClickListener,
SurfaceHolder.Callback, Camera.PictureCallback {
SurfaceView cameraView;
SurfaceHolder surfaceHolder;
Camera camera;
這種活動(dòng)非常類似于SnapShot活動(dòng)。我們需要添加一個(gè)Button對(duì)象來(lái)觸發(fā)倒計(jì)時(shí)的開(kāi)始,并且添加一個(gè)TextView對(duì)象來(lái)顯示倒計(jì)時(shí)。
Button startButton;
TextView countdownTextView;
還需要一個(gè)Handler對(duì)象,在當(dāng)前情況下是timerUpdateHandler;需要一個(gè)布爾值來(lái)幫助我們跟蹤計(jì)時(shí)器是否已經(jīng)開(kāi)始(timerRunning);同時(shí)還要有一個(gè)整數(shù)(currentTime)用于跟蹤倒計(jì)時(shí)。