本文整理汇总了Java中com.android.camera.exif.ExifInterface.setTag方法的典型用法代码示例。如果您正苦于以下问题:Java ExifInterface.setTag方法的具体用法?Java ExifInterface.setTag怎么用?Java ExifInterface.setTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.camera.exif.ExifInterface
的用法示例。
在下文中一共展示了ExifInterface.setTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLocationToExif
import com.android.camera.exif.ExifInterface; //导入方法依赖的package包/类
/**
* Adds the given location to the given exif.
*
* @param exif The exif to add the location tag to.
* @param location The location to add.
*/
public static void addLocationToExif(ExifInterface exif, Location location) {
exif.addGpsTags(location.getLatitude(), location.getLongitude());
exif.addGpsDateTimeStampTag(location.getTime());
double altitude = location.getAltitude();
if (altitude == 0) {
return;
}
short altitudeRef = altitude < 0 ? ExifInterface.GpsAltitudeRef.SEA_LEVEL_NEGATIVE
: ExifInterface.GpsAltitudeRef.SEA_LEVEL;
exif.setTag(exif.buildTag(ExifInterface.TAG_GPS_ALTITUDE_REF, altitudeRef));
}
示例2: updateExifData
import com.android.camera.exif.ExifInterface; //导入方法依赖的package包/类
private void updateExifData(ExifInterface exif, long time) {
// Set tags
exif.addDateTimeStampTag(ExifInterface.TAG_DATE_TIME, time,
TimeZone.getDefault());
exif.setTag(exif.buildTag(ExifInterface.TAG_ORIENTATION,
ExifInterface.Orientation.TOP_LEFT));
// Remove old thumbnail
exif.removeCompressedThumbnail();
}
示例3: savePanorama
import com.android.camera.exif.ExifInterface; //导入方法依赖的package包/类
private Uri savePanorama(byte[] jpegData, int width, int height, int orientation) {
if (jpegData != null) {
String filename = PanoUtil.createName(
mActivity.getResources().getString(R.string.pano_file_name_format), mTimeTaken);
String filepath = Storage.generateFilepath(filename);
Location loc = mLocationManager.getCurrentLocation();
ExifInterface exif = new ExifInterface();
try {
exif.readExif(jpegData);
exif.addGpsDateTimeStampTag(mTimeTaken);
exif.addDateTimeStampTag(ExifInterface.TAG_DATE_TIME, mTimeTaken,
TimeZone.getDefault());
exif.setTag(exif.buildTag(ExifInterface.TAG_ORIENTATION,
ExifInterface.getOrientationValueForRotation(orientation)));
writeLocation(loc, exif);
exif.writeExif(jpegData, filepath);
} catch (IOException e) {
Log.e(TAG, "Cannot set exif for " + filepath, e);
Storage.writeFile(filepath, jpegData);
}
int jpegLength = (int) (new File(filepath).length());
return Storage.addImage(mContentResolver, filename, mTimeTaken,
loc, orientation, jpegLength, filepath, width, height);
}
return null;
}
示例4: writeLocation
import com.android.camera.exif.ExifInterface; //导入方法依赖的package包/类
private static void writeLocation(Location location, ExifInterface exif) {
if (location == null) {
return;
}
exif.addGpsTags(location.getLatitude(), location.getLongitude());
exif.setTag(exif.buildTag(ExifInterface.TAG_GPS_PROCESSING_METHOD, location.getProvider()));
}