Question

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

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top