I am making an application in which i am getting an Mjpg Images from Live IP Camera in Android.
The problem is that since when i get the Image in the form of ByteArray
. How can I display the Image
?
I'm using the following code to display the image:
ImageView imageView = (ImageView) findViewById(R.id.imageView1);
Bitmap bmp = BitmapFactory.decodeByteArray(buffer, start, a);
imageView.setImageBitmap(bmp);
but i m getiing an exception
android.view.ViewRoot CallFromWrongThreadException
Please explain how to display the bytearray on android layout.
ImageView tv1;
tv1= (ImageView) findViewById(R.id.image);
InputStream si1 = asset.open("image/" + cat_arr1[i] + ".png");
Bitmap bitmap1 = BitmapFactory.decodeStream(si1);
tv1.setImageBitmap(bitmap1);