Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.os.Build;

import java.io.File;

public class Main {
    static String getFilePathFromUrl(final Context c, final String url) {
        return getDir(c).getAbsoluteFile() + "/" + url.substring(url.lastIndexOf("/") + 1);
    }

    static File getDir(final Context c) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            return c.getNoBackupFilesDir();
        else
            return c.getFilesDir();
    }
}