write byte array to apk File - Android App

Android examples for App:APK File

Description

write byte array to apk File

Demo Code


//package com.java2s;
import android.os.Environment;
import java.io.FileOutputStream;
import java.io.IOException;

public class Main {
    public static void writeFile(byte[] bytes) throws IOException {
        String apkDir = Environment.getExternalStorageDirectory()
                + "/download/" + "app.apk";
        java.io.File file = new java.io.File(apkDir);
        FileOutputStream fop = new FileOutputStream(file);
        fop.write(bytes);/* w w  w .  ja va2 s .c  o m*/
        fop.flush();
        fop.close();
    }
}

Related Tutorials