package com.appassit.tools; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import android.content.Context; import android.content.Intent; import android.net.Uri; public class CommonUtils { public static void install(String path, Context act) { try { String apkPath = path; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + apkPath), "application/vnd.android.package-archive"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); act.startActivity(intent); } catch (Exception e) { } } public static byte[] InputStreamToByte(InputStream is) throws IOException { ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); int ch; while ((ch = is.read()) != -1) { bytestream.write(ch); } byte imgdata[] = bytestream.toByteArray(); bytestream.close(); return imgdata; } }