Example usage for android.content ContextWrapper getFilesDir

List of usage examples for android.content ContextWrapper getFilesDir

Introduction

In this page you can find the example usage for android.content ContextWrapper getFilesDir.

Prototype

@Override
    public File getFilesDir() 

Source Link

Usage

From source file:Main.java

public static File getDataDirectory(Context ctx) {
    File f;/* w  w w  . j  a v a  2 s .  c  o  m*/

    if (Environment.getExternalStorageState().equals("mounted")) {
        //Has SD Card mounted
        f = Environment.getExternalStorageDirectory();
    } else {
        ContextWrapper c = new ContextWrapper(ctx);

        f = c.getFilesDir();
    }

    return f;
}

From source file:Main.java

/**
 * Copy IP channel list/*from   w ww . jav a  2 s  . c om*/
 *
 * @param filename File name of IP channel list in assets directory
 */
private static void copyFile(String filename) {
    ContextWrapper contextWrapper = new ContextWrapper(mContext);
    String file = contextWrapper.getFilesDir().getPath() + "/" + filename;
    File fl = new File(file);
    if (!fl.exists())
        copyAssetToData(fl);
}

From source file:com.iwedia.activities.DTVActivity.java

/**
 * Copy configuration file./*from w ww .ja  v  a2 s.c o  m*/
 */
private void copyFile(String filename) {
    ContextWrapper contextWrapper = new ContextWrapper(this);
    String file = contextWrapper.getFilesDir().getPath() + "/" + filename;
    File fl = new File(file);
    if (!fl.exists())
        copyAssetToData(fl);
}