运行下面的代码结果报错。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;
}
// 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;
}
2 回答
ibeautiful
TA贡献1993条经验 获得超5个赞
mediaFile = new File.createTempFile("dsadsa", ".jpg");
改成:
mediaFile = File.createTempFile("dsadsa", ".jpg");
添加回答
举报
0/150
提交
取消