Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;

import java.io.IOException;

import android.content.Context;

public class Main {
    public static File getMateralDir(Context context) {

        File dir = null;
        dir = new File(context.getCacheDir() + File.separator + "wanjia" + File.separator + "material");
        File nomediaFile = new File(dir.getAbsolutePath() + File.separator + ".nomedia");
        if (!dir.exists()) {
            dir.mkdirs();
        }
        if (!nomediaFile.exists()) {
            try {
                nomediaFile.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return dir;
    }
}