Domanda

I want to protect a lot of my png and JPEG (actually in the drawable folder), because it's very easy to decompile an APK and take the images.
How can I make another coded folder and set android:src for ImageView in XML layouts?
Thanks

È stato utile?

Soluzione

For this you should have to encrypt the image using linear algebra techniques. convert your image in matrix and then reverse this mat for encryption or you have many techniques to encrypt this mat.Some thing like this.

    public byte[] getBytesFromBitmap(Bitmap bitmap) {
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bitmap.compress(CompressFormat.JPEG, 70, stream);
    return stream.toByteArray();
}

hope this will help.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top