Hey guys,
I've got 2 classes GLLayer
and GLCamTest
. I'm attempting to run a method located in 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;
}
I'm looking to run in on a thread from GLLayer
but from what I understand I need a Handler..
public void run() {
GLCamTest cam = new GLCamTest();
image = cam.extractimage(q);
}
I'm starting the Thread from within public void onDrawFrame(GL10 gl) {
my question is how would I implement said handler? I've read http://developer.android.com/reference/android/os/Handler.html but I still don't really understand how I'd implement it. could someone help me out?