Java tutorial
//package com.java2s; import android.text.TextUtils; public class Main { public static String buildFileName(String msgId, String url) { return msgId + "_" + getFileName(url); } public static String getFileName(String url) { if (TextUtils.isEmpty(url)) { return ""; } return url.substring(url.lastIndexOf("/") + 1); } }