In android, quando apriamo uno screenshot dalla galleria. Viene sfocato per 2 secondi e poi si auto regola automaticamente.L'immagine non si regola automaticamente
Ma quando io sto usando questa immagine screenshot per impostare su un imageview mezzo del percorso di immagine come:,
immagine Path è: /mnt/sdcard/ScreenCapture/SC20130219-124221.png
private void showImage(String imgPath) {
// TODO Auto-generated method stub
System.out.println("Image Path is: "+imgPath);
ImageView openImage=(ImageView)findViewById(R.id.img_fullScreen);
ExifInterface exifMedia = null;
try {
exifMedia = new ExifInterface(imgPath);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String exifOrint = exifMedia.getAttribute(ExifInterface.TAG_ORIENTATION);
int exifOrientation = Integer.parseInt(exifOrint);
System.out.println("Orientation Tag is:"+exifOrientation);
BitmapFactory.Options mOptions=new BitmapFactory.Options();
mOptions.inSampleSize=2;
Bitmap imgBitmap = BitmapFactory.decodeFile(imgPath,mOptions);
//Runtime.getRuntime().gc();
imgBitmap = getResizedBitmapImage(imgBitmap, 200, 200, exifOrientation);
openImage.setImageBitmap(imgBitmap);
}
Un altro caso: mentre si ottiene Bitmap dall'URL come:
URL url = new URL(urlTarget);
BitmapFactory.Options mOptions = new BitmapFactory.Options();
mOptions.inSampleSize=1;
Bitmap bmp = BitmapFactory.decodeStream(url
.openConnection().getInputStream(),null,mOptions);
Quindi l'immagine non viene regolata automaticamente. Viene SPURATO. QUESTO È IL MIO PROBLEMA.
È SOLO NEL CASO DI SCREENSHOT.
grazie
Potrebbe incollare il metodo getResizedBitmapImage()? –
È uno screenshot quindi usa 'mOptions.inSampleSize = 1;'. Altrimenti, diventerà sicuramente sfocata –
Ciao @SherifelKhatib Mi ha aiutato nel caso precedente ma nel caso di ottenere la bitmap dall'URL, non funziona. Puoi dirmi come usare in Sampleampize in caso di ottenere la bitmap dall'URL. Ho modificato il mio codice. Si prega di dare un'occhiata –