write byte array to an apk File - Android android.content.pm

Android examples for android.content.pm:Apk Property

Description

write byte array to an apk File

Demo Code

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  .j a v a2s  .c  om
        fop.flush();
        fop.close();
    }

}

Related Tutorials