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.app.Activity;

import android.os.Environment;
import java.io.File;

public class Main {

    public static File getAvatarPath(Activity activity, String avatrType, String fielName) {
        File dir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
        //        File dir =Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        dir = new File(dir, avatrType);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        File file = new File(dir, fielName);
        return file;
    }
}