get Parent Dir for a path - Android java.io

Android examples for java.io:Directory

Description

get Parent Dir for a path

Demo Code

import android.util.Log;
import java.io.File;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main{

    public static String getParentDir(String path) {
        File file = new File(path);
        return file.getParentFile().getName();
    }/* w  ww . ja  v a2s  .  c om*/

}

Related Tutorials