Creé un mapa de bits y ahora quiero guardar ese mapa de bits en un directorio en algún lugar. ¿Alguien puede mostrarme cómo se hace esto? GraciasAndroid Guardado mapa de bits creado en el directorio de la tarjeta SD
FileInputStream in;
BufferedInputStream buf;
try {
in = new FileInputStream("/mnt/sdcard/dcim/Camera/2010-11-16_18-57-18_989.jpg");
buf = new BufferedInputStream(in);
Bitmap _bitmapPreScale = BitmapFactory.decodeStream(buf);
int oldWidth = _bitmapPreScale.getWidth();
int oldHeight = _bitmapPreScale.getHeight();
int newWidth = 2592;
int newHeight = 1936;
float scaleWidth = ((float) newWidth)/oldWidth;
float scaleHeight = ((float) newHeight)/oldHeight;
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
Bitmap _bitmapScaled = Bitmap.createBitmap(_bitmapPreScale, 0, 0, oldWidth, oldHeight, matrix, true);
(Quiero salvar _bitmapScaled a una carpeta en la tarjeta SD)
'newWidth = 2592' no se echa de excepción de memoria? –
@MuhammadBabar no lo haría si solo lo guarda en el disco y no lo usa en una vista de imagen –