Android examples for java.io:File Path
get path to the given file , e.g. : c:\test\aaa.html -> c:\test\
import android.graphics.Paint; import android.graphics.Paint; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; public class Main{ /**//from ww w . ja v a 2s. c o m * get path to the given file , e.g. : c:\test\aaa.html -> c:\test\ * * @param fileFullPath * path to file; * @return */ public static String getFilePath(String fileFullPath) { int sep = fileFullPath.lastIndexOf("\\") == -1 ? fileFullPath .lastIndexOf("/") : fileFullPath.lastIndexOf("\\"); return fileFullPath.substring(0, sep + 1); } }