ByteArrayOutputStream out = new ByteArrayOutputStream();
String path = "res/drawable/sample.yuv";
byte buffer[];
buffer = new byte[1024*1024];
InputStream is = getClassLoader().getResourceAsStream(path);
try{
is.read(buffer);
}catch (Exception e)
{
e.printStackTrace();
}
YuvImage yuvImage;
yuvImage = new YuvImage(buffer, ImageFormat.NV21, 640, 480, null);
yuvImage.compressToJpeg(new Rect(0, 0, 640, 480), 50, out);
byte[] imageBytes = out.toByteArray();
Bitmap image = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
ImageView iv = (ImageView) findViewById(R.id.iv);
iv.setImageBitmap(image);