我如何在这里实现处理程序?

时间:2010-07-20 12:49:34

标签: android handler

我有2个课程GLLayerGLCamTest。我正在尝试运行位于GLCamTest ...

的方法
        public Bitmap extractimage(int pos){
    LocationData tweets;
    tweets = new LocationData(this);
    SQLiteDatabase db = tweets.getWritableDatabase();
    //select the data
    String query = "SELECT * FROM tweets;";
    Cursor mcursor = db.rawQuery(query, null);
    //Move to Position specified.
    mcursor.moveToPosition(pos);

    //get it as a ByteArray
    byte[] imageByteArray=mcursor.getBlob(7);
    //the cursor is not needed anymore
    mcursor.close();

    //convert it back to an image
    ByteArrayInputStream imageStream = new ByteArrayInputStream(imageByteArray);
    Bitmap theImage = BitmapFactory.decodeStream(imageStream);
    return theImage;
    }

我正在寻找GLLayer的帖子,但据我所知,我需要一个处理程序..

            public void run() {
    GLCamTest cam = new GLCamTest();
    image = cam.extractimage(q);

}

我从public void onDrawFrame(GL10 gl) {内部启动线程我的问题是如何实现所述处理程序?我读过http://developer.android.com/reference/android/os/Handler.html但我仍然不明白我是如何实现它的。有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:1)