Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.os.Environment; import java.io.File; public class Main { public static void renameImageFileName(Context context, String oldImgName, String newImgName) { String dir = getDir(context, oldImgName); File oldFile = new File(dir); dir = getDir(context, newImgName); File newFile = new File(dir); oldFile.renameTo(newFile); } public static String getDir(Context context, String path) { // File dir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES); File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); path = dir.getAbsolutePath() + "/" + path; return path; } }