I'm not sure why you can't just use a thread (no handler)?
If you do need a handler, you can just create a new runnable, and post
it to the handler with something like:
new Handler().post(new Runnable(){
public void run(){
image = new GLCamTest().extractimage(q);
}
});
(Obviously, the code above isn't perfect, but hopefully it helps);
On Jul 20, 9:28 am, Aidan C <[email protected]> wrote:
> 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
> readhttp://developer.android.com/reference/android/os/Handler.htmlbut I
> still don't really understand how I'd implement it. could someone help
> me out?
--
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