create Image Name from current time - Android android.graphics

Android examples for android.graphics:Bitmap Load Save

Description

create Image Name from current time

Demo Code

import android.annotation.SuppressLint;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main{

    @SuppressLint("SimpleDateFormat")
    public static String createImageName() {
        SimpleDateFormat dateFormat = new SimpleDateFormat(
                "yyyyMMdd_HHmmss");
        return "IMG"
                + dateFormat.format(new Date(System.currentTimeMillis()))
                + ".jpg";
    }//ww  w .j  a va 2  s. co  m

}

Related Tutorials