Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

import android.support.v4.content.ContextCompat;

import java.io.File;

public class Main {
    public static File makeTmpFile(Context context, String prefix, String suffix) {
        File tmpOutFile = null;
        try {
            //            File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
            File dir = ContextCompat.getExternalCacheDirs(context)[0];
            tmpOutFile = File.createTempFile(prefix, suffix, dir);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return tmpOutFile;
    }
}