get Temp Uri - Android Network

Android examples for Network:Uri

Description

get Temp Uri

Demo Code


//package com.java2s;
import java.io.File;

import android.net.Uri;
import android.os.Environment;

public class Main {

    public static final String FILE_PATH = Environment
            .getExternalStorageDirectory().toString() + "/mmf/";

    public static Uri getTempUri() {
        String fileName = System.currentTimeMillis() + ".jpg";
        File out = new File(FILE_PATH);
        if (!out.exists()) {
            out.mkdirs();/*from   w  w  w. j av a2  s  . c o m*/
        }
        out = new File(FILE_PATH, fileName);
        return Uri.fromFile(out);
    }
}

Related Tutorials