EIN:
Bitmap immutableBmp= BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.sample);
mutableBitmap=immutableBmp.copy(Bitmap.Config.ARGB_8888, true);
B:
Bitmap immutableBmp= BitmapFactory.decodeFile(filePath);
mutableBitmap=immutableBmp.copy(Bitmap.Config.ARGB_8888, true);
C:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inMutable=true;
myBitmap=BitmapFactory.decodeFile(filePath,options);
A funktioniert, aber B und C nicht. Ich versuche, eine unveränderliche Bitmap in eine veränderliche zu konvertieren. Es funktioniert für Ressourcenimages, aber nicht für Dateibilder. Was ist das Problem?
Ich habe das Problem gefunden! Alle drei der oben genannten Methoden funktionieren, es gab ein Problem mit der Auflösung meines Bildes. Daher dachte ich, der Code funktioniere nicht und es sei nicht veränderbar, aber ich lag falsch. Hier ist eine weitere Lösung, um ein unveränderliches Bild in veränderlich zu ändern.
Ich habe es gefunden:
Bitmap bmp_Copy = bmp_Base.copy(Bitmap.Config.ARGB_8888,true);