package cn.itcast.exif;
import android.app.Activity;
import android.media.ExifInterface;
import android.os.Bundle;
public class DemoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
ExifInterface exif = new ExifInterface("/data/data/imag_2.jpg");
// System.out.println( exif.getAttribute("ImageDescription"));
System.out.println( exif.getAttribute(ExifInterface.TAG_DATETIME));
System.out.println( exif.getAttribute(ExifInterface.TAG_IMAGE_LENGTH));
System.out.println( exif.getAttribute(ExifInterface.TAG_IMAGE_WIDTH));
exif.setAttribute("camera", "柯达相机");
System.out.println( exif.getAttribute("camera"));
} catch (Exception e) {
e.printStackTrace();
}
}
}