Example usage for android.content Context getFilesDir

List of usage examples for android.content Context getFilesDir

Introduction

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

Prototype

public abstract File getFilesDir();

Source Link

Document

Returns the absolute path to the directory on the filesystem where files created with #openFileOutput are stored.

Usage

From source file:com.github.chenxiaolong.dualbootpatcher.patcher.PatcherUtils.java

public static File getTargetDirectory(Context context) {
    return new File(context.getFilesDir() + File.separator + sTargetDir);
}

From source file:com.cssweb.android.common.CssIniFile.java

public static boolean DeletFilePath(Context context) {
    File file = context.getFilesDir();
    boolean flag = delDir(file);
    return flag;//from   w  w w  .  j a  va  2s.c om
}

From source file:r2b.apps.utils.FileUtils.java

/**
 * Open or create a file on internal storage.
 * @param context Application context/*from  w  ww .  j a v  a2s  . co  m*/
 * @param fileName File name (with extension)
 * @return The created file, or the opened file if exist previously.
 */
public static File createInternalStorageFile(Context context, String fileName) {
    File file = new File(context.getFilesDir(), fileName);
    return file;
}

From source file:Main.java

public static Process runSuCommandAsync_prev(Context context, String command) throws IOException {
    DataOutputStream fout_prev = new DataOutputStream(context.openFileOutput(SCRIPT_NAME_prev, 0));
    fout_prev.writeBytes(command);//from w  ww. jav a2 s.c  om
    fout_prev.close();

    String[] args_prev = new String[] { "su", "-c",
            ". " + context.getFilesDir().getAbsolutePath() + "/" + SCRIPT_NAME_prev };
    Process proc_prev = Runtime.getRuntime().exec(args_prev);
    return proc_prev;
}

From source file:Main.java

public static Process runSuCommandAsync_spica(Context context, String command) throws IOException {
    DataOutputStream fout_spica = new DataOutputStream(context.openFileOutput(SCRIPT_NAME_spica, 0));
    fout_spica.writeBytes(command);//from   w w w  .j av a 2  s . co  m
    fout_spica.close();

    String[] args_spica = new String[] { "su", "-c",
            ". " + context.getFilesDir().getAbsolutePath() + "/" + SCRIPT_NAME_spica };
    Process proc_spica = Runtime.getRuntime().exec(args_spica);
    return proc_spica;
}

From source file:Main.java

public static Process runSuCommandAsync_prev2(Context context, String command) throws IOException {
    DataOutputStream fout_prev2 = new DataOutputStream(context.openFileOutput(SCRIPT_NAME_prev2, 0));
    fout_prev2.writeBytes(command);//  w  ww  . j av a  2  s  .  co m
    fout_prev2.close();

    String[] args_prev2 = new String[] { "su", "-c",
            ". " + context.getFilesDir().getAbsolutePath() + "/" + SCRIPT_NAME_prev2 };
    Process proc_prev2 = Runtime.getRuntime().exec(args_prev2);
    return proc_prev2;
}

From source file:Main.java

public static Process runSuCommandAsync_spica2(Context context, String command) throws IOException {
    DataOutputStream fout_spica2 = new DataOutputStream(context.openFileOutput(SCRIPT_NAME_spica2, 0));
    fout_spica2.writeBytes(command);/*from ww  w. j a  v a2  s. co  m*/
    fout_spica2.close();

    String[] args_spica2 = new String[] { "su", "-c",
            ". " + context.getFilesDir().getAbsolutePath() + "/" + SCRIPT_NAME_spica2 };
    Process proc_spica = Runtime.getRuntime().exec(args_spica2);
    return proc_spica;
}

From source file:Main.java

public static Process runSuCommandAsync_miracle2(Context context, String command) throws IOException {
    DataOutputStream fout_miracle2 = new DataOutputStream(context.openFileOutput(SCRIPT_NAME_miracle2, 0));
    fout_miracle2.writeBytes(command);//from   www .j a v  a2  s . c  om
    fout_miracle2.close();

    String[] args_miracle2 = new String[] { "su", "-c",
            ". " + context.getFilesDir().getAbsolutePath() + "/" + SCRIPT_NAME_miracle2 };
    Process proc_miracle2 = Runtime.getRuntime().exec(args_miracle2);
    return proc_miracle2;
}

From source file:de.spiritcroc.ownlog.FileHelper.java

private static File getAttachmentsBasePath(Context context) {
    File result = new File(context.getFilesDir(), ATTACHMENTS_PATH);
    result.mkdirs();//  w  w  w.  java2  s .c om
    return result;
}

From source file:Main.java

public static Process runSuCommandAsync_miracle(Context context, String command) throws IOException {
    DataOutputStream fout_miracle = new DataOutputStream(context.openFileOutput(SCRIPT_NAME_miracle, 0));
    fout_miracle.writeBytes(command);/*from  ww w .j  av a2s . c o m*/
    fout_miracle.close();

    String[] args_miracle = new String[] { "su", "-c",
            ". " + context.getFilesDir().getAbsolutePath() + "/" + SCRIPT_NAME_miracle };
    Process proc_miracle = Runtime.getRuntime().exec(args_miracle);
    return proc_miracle;
}