Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

import java.io.File;

public class Main {
    /**
     * Get APNG working directory
     * @param context Application Context
     * @return Reference to the working directory
     */
    public static File getWorkingDir(Context context) {
        File workingDir = null;
        File cacheDir = context.getExternalCacheDir();

        if (cacheDir == null) {
            cacheDir = context.getCacheDir();
        }

        if (cacheDir != null) {
            workingDir = new File(String.format("%s/apng/.nomedia/", cacheDir.getPath()));

            if (!workingDir.exists()) {
                workingDir.mkdirs();
            }
        }

        return workingDir;
    }
}