1

I am trying to play video, where I get frames as bitmaps from the native code and I want to display the video on the screen. I do not understand how to display them, as there are view, surface, animation and graphics and I have no idea, which one to use from these. I am very beginner to android. Please help me choosing and let me know if there are any samples.

Thanks for any help

2 Answers 2

1

I am able to solve it myself. Answer is as follows

C Code :

in renderbitmap function

AndroidBitmapInfo  info;
void*              pixels;
int                ret;

if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
return;
}

if (info.format != ANDROID_BITMAP_FORMAT_RGB_565) {
return;
}

if ((ret =AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
}

memcpy(pixels, pictureRGB, 480*320);

AndroidBitmap_unlockPixels(env, bitmap);

Java Code

 Bitmap mBitmap = Bitmap.createBitmap(480, 320, Bitmap.Config.RGB_565);
 renderbitmap(mBitmap, 0);
 canvas.drawBitmap(mBitmap, 0, 0, null);
0

Ok, so displaying bitmaps can be done using imageviews that can be embedded in your layout.

ImageView bmImage = (ImageView)findViewById(R.id.image);
bmImage.setImageBitmap(bitmap); // insert bitmap that you get from video

Did i understand you correctly?)

1
  • NO. This when you have an image from resource. What if you have read the pixel information and want to display bitmaps to display a video frame? Feb 15, 2011 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.