报错:cannot resolve symbol createTempFile

0
Android Java C/C++ TempFile 6543 次浏览
运行下面的代码结果报错。

cannot resolve symbol createTempFile

代码:

import java.io.File;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;

public final class Util
{
static Bitmap image;

public static File getOutputMediaFile(byte[] data)
{

    image= BitmapFactory.decodeByteArray(data, 0, data.length);


    File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "FrontFlash");



    // Create the storage directory if it does not exist
    if (!mediaStorageDir.exists())
    {
        if (!mediaStorageDir.mkdirs()) return null;
    }//www.sctarena.com

    // Create a media file name
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    File mediaFile=null;

    //mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg");

       mediaFile = new File.createTempFile("dsadsa", ".jpg");

    return mediaFile;
}

请尽量让自己的答案能够对别人有帮助

3个答案

默认排序 按投票排序