图片不会节省三星Nexus [英] Pictures wont save on Samsung Nexus

查看:171
本文介绍了图片不会节省三星Nexus的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题。我从我自己的应用程序中内置的Photoapplication用照片意图开始。

I have a Problem. I start from my own Application the Build-In Photoapplication with a Photo-Intent.

        String photoName = System.currentTimeMillis() + ".jpg"; 

        File file = new File(getFilesDir(),//Environment.getExternalStoragePublicDirectory(
                //Environment.DIRECTORY_DCIM),
                photoName); // Anlegen der Datei im entsprechenden
                            // Verzeichnis
        FileOutputStream fos = null;
        try {
            fos = openFileOutput(photoName, Context.MODE_WORLD_WRITEABLE);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {
            fos.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        outputFileUri = Uri.fromFile(file);
        intentPhoto.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
        //startActivity(intentPhoto);
        startActivityForResult(intentPhoto, TAKE_PICTURE);

这是我的code以启动活动。正如你所看到的,我做的第一件事是建立在文件中的目录,然后给意图文件的位置来存储它。

This is my Code to start the Activity. As you can see, the first thing i do is to set up the file in the directory and then give the intent the location of the file to store it.

但每次我把它不会保存到图片目录图片。保存照片的唯一方法是关闭手机并重新启动。每当我已经采取befor图片是存在的。这种情况自上次更新至4.1.1。 Befor我更新了电话,一切运行良好,但自从我更新有这个问题。

But everytime i take a picture it is not saved to the Pictures Directory. The only way to save the picture is to turn off the phone and restart it. Then every picture I have taken befor is there. This happens since the last updated to 4.1.1. Befor i updated the phone, everything worked fine, but since the update I have this problem.

有人可以帮我吗?有没有人有同样的问题?

Can somebody help me? Does anyone have the same Issue?

推荐答案

现在工作正常,问题是,我用我自己创建文件,用:

It works fine now, the problem was that I create the File by my self, with:

File file = new File(..); 

但你必须使用:

ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, "IMG_"+ timeStamp+.jpg"); 

和放入的意图,将文件保存一次,无需重新启动手机。

And put it into the intent to save the file at once without restarting the phone.

这篇关于图片不会节省三星Nexus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆