Hi,
I am new to android. and I have been assigned a task to capture the android
screen and send the collected the data through USB or bluetooth to the other
device.
Do we have any android API to get the framebuffer data. If not then how to
proceed with the task?
If I can get a sample code, I would be greatful to you.
I have tried with the following code but the output is all zeros.
kindly correct me If I am going in a worng way. and suggest me how to
complete the task with the sample code.
public class ScreenCaptureEx extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// get the screen width and height
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int screenWidth = dm.widthPixels;
int screenHeight = dm.heightPixels;
TextView tv= (TextView) findViewById(R.id.label);
byte buffer[]=new byte[screenWidth];
ByteBuffer pixel=ByteBuffer.wrap(buffer);
int x=0,y=0;
tv.setText(" screen width and height " + screenWidth + " " +
screenHeight + "\n");
// read the pixel from the framebuffer
GLES10.glReadPixels(x, y, screenWidth, screenHeight,GLES10.GL_RGB,
GLES10.GL_UNSIGNED_SHORT_5_6_5, pixel);
buffer = pixel.array();
int temp;String temp1;
for(int l=0;l<pixel.limit();l++)
{
temp=pixel.get(l);
temp1=tv.getText().toString();
tv.setText(temp1 + temp);
Integer i= Integer.valueOf(temp);
Log.d(" pixel data",i.toString());
}
}
--
Thanks & Regards
Shilpa
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en