我试图从图库中选择和图像,并使用ExifInterface打印它的路径以及gps标签.我正在使用nexus 4(kitkat 4.4.2)进行调试,我得到的图像路径是
/ storage/emulated/0/DCIM/image_file_name但是ExifInterface为所有标签返回null,并且logcat显示错误JHEAD无法打开'/ storage/emulated/0/DCIM/image_file_name'(应用程序不会崩溃).请帮忙.
主要活动代码:
package com.example.images;
import java.io.File;
import java.io.IOException;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); …Run Code Online (Sandbox Code Playgroud)