package com.hyzhou.pngexifdemo;

import android.media.ExifInterface;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.Toast; public class MainActivity extends Activity { private ImageView img;
String path="sdcard/DCIM/Camera/IMG_20130924_134616.jpg";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
img=(ImageView)findViewById(R.id.imageView1);
Bitmap bitmap=BitmapFactory.decodeFile(path);
try {
img.setImageBitmap(bitmap);
} catch (Exception e) {
e.printStackTrace();
}
/*
* 目前Android SDK定义的Tag有:
TAG_DATETIME 时间日期
TAG_FLASH 闪光灯
TAG_GPS_LATITUDE 纬度
TAG_GPS_LATITUDE_REF 纬度参考
TAG_GPS_LONGITUDE 经度
TAG_GPS_LONGITUDE_REF 经度参考
TAG_IMAGE_LENGTH 图片长
TAG_IMAGE_WIDTH 图片宽
TAG_MAKE 设备制造商
TAG_MODEL 设备型号
TAG_ORIENTATION 方向
TAG_WHITE_BALANCE 白平衡
*/ try {
//android读取图片EXIF信息
ExifInterface exifInterface=new ExifInterface(path);
String smodel=exifInterface.getAttribute(ExifInterface.TAG_MODEL);
String width=exifInterface.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
String height=exifInterface.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
Toast.makeText(MainActivity.this, smodel+" "+width+"*"+height, Toast.LENGTH_LONG).show();
} catch (Exception e) {
e.printStackTrace();
} } @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
} }

Android中显示照片的Exif信息的更多相关文章

  1. Android中读取图片EXIF元数据之metadata-extractor的使用

    一.引言及介绍 近期在开发中用到了metadata-extractor-xxx.jar 和 xmpcore-xxx.jar这个玩意, 索性查阅大量文章了解学习,来分享分享. 本身工作也是常常和处理大图 ...

  2. Android中读取短信信息

    Android中读取的短信文件有 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 /**  * 所有的短信  */ public static final Strin ...

  3. Android中利用SharedPreferences保存信息

    package com.example.sharepreferen; import android.content.Context; import android.content.SharedPref ...

  4. Android中获取系统内存信息以及进程信息-----ActivityManager的使用(一)

    本节内容主要是讲解ActivityManager的使用,通过ActivityManager我们可以获得系统里正在运行的activities,包括 进程(Process)等.应用程序/包.服务(Serv ...

  5. 我的Android进阶之旅------>Android中查看应用签名信息

    一.查看自己的证书签名信息 如上一篇文章<我的Android进阶之旅------>Android中制作和查看自定义的Debug版本Android签名证书>地址:http://blog ...

  6. Android中垃圾回收日志信息

    原因 GC_CONCURRENTfreed 178K, 41% free 3673K/6151K, external 0K/0K, paused 2ms+2msGC_EXPLICITfreed 6K, ...

  7. uiautomatorviewer 可以查看到android中的web 元素信息

    以知乎社区账号登录使用微博账号为例,使用uiautomatorviewer 可以定位到登录框.密码框,需要结合appium的inspector 1.genymotion 模拟器开启,模拟器安卓系统为4 ...

  8. 【转载】理解Android中垃圾回收日志信息

    本文转自:http://droidyue.com/blog/2014/11/08/understanding-garbage-collection-output-messages-in-android ...

  9. Android中获取手机电量信息

    有些时候我们需要在我们的应用上为用户展示当前手机的电量,这时候我们就需要用到广播了,我们都知道在动态注册广播的时候,我们需要传入一个BroadcastReceiver类对象,还有一个意图过滤器Inte ...

随机推荐

  1. 在PHP中使用协程实现多任务调度

    PHP5.5一个比较好的新功能是加入了对迭代生成器和协程的支持.对于生成器,PHP的文档和各种其他的博客文章已经有了非常详细的讲解.协程相对受到的关注就少了,因为协程虽然有很强大的功能但相对比较复杂, ...

  2. C# 最全的系统帮助类

    using System;using System.Collections;using System.Collections.Generic;using System.Configuration;us ...

  3. javascript小技巧[转]

    总的来说,如果你要找js 的东西,而不看这两篇的话,肯定要多花好多时间!!哈哈!! 如果你找的javascript的东西的话,建议你 ctrl+F  直接在这个页上找,因为这里80%有你要找的,但是要 ...

  4. Python 类的初见

    #定义一个Python类 class Cat: #self关键字相当于c++类中的this指针 def eat(self): print("i am eating .") def ...

  5. android O 蓝牙设备默认名称更改

    安卓系统会首先读取BTM_DEF_LOCAL_NAME的值,如果为空,就使用"ro.product.model"作为蓝牙设备名. system/bt/btif/src/btif_d ...

  6. 模式识别之bpnn---神经网络训练

    http://blog.csdn.net/linj_m/article/details/40679085

  7. application/json 与 application/x-www-form-urlencoded的简单比较

    application/x-www-form-urlencoded 提交请求示例 curl -X POST 'http://localhost:8080/formPost' -d 'id=1& ...

  8. Linux--nginx域名绑定-url rewrite

    进入/usr/local/nginx/conf 编辑 nginx.conf 绑定域名: 添加一个 server元素,更改后的配置内容可能如下: server { listen       80; se ...

  9. Java Number类

    一般地,当需要使用数字的时候,我们通常使用内置数据类型,如:byte.int.long.double等. 例如: int i = 5000; float gpa = 13.65; byte mask ...

  10. IntelliJ IDEA 的 .idea 目录加入.gitignore无效的解决方法

    [转载] 无效的原因是:对应的目录或者文件已经被git跟踪,此时再加入.gitignore后就无效了, 解决办法: 先执行 [文件夹]  git rm -r --cached .idea [文件]   ...