get Temp Uri - Android android.net

Android examples for android.net:Uri

Description

get Temp Uri

Demo Code

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();/* w  w w .  j  av  a2s.c o  m*/
    }
    out = new File(FILE_PATH, fileName);
    return Uri.fromFile(out);
  }

}

Related Tutorials