help on graphics from newbie

by social hub » Sat, 27 Feb 2010 01:06:07 GMT


Sponsored Links
 Guys,

I almost there of what i want to do but i am stuck at a point where I need
some expert pointers

this is what i do so far

I have rectangle white box

on cliking the rectangle I will draw a toolbar beneath the box and also call
relayout to accomodate the toolbar ( size+100) ( i used surfaceview and in
secondary thread i draw the toolbar)

on click again on rectangle box it will disappear the toolbar and also has
to resize the layout to original size (ie size-100) this is where I get
stuck.

I can disappear the toolbar however I cant call relayout either from
secondary thread (says cant call from secondary thread).

So I created a while loop in onlayout( this is where i create a thread to
draw the toolbar)  if i call requestlayout after while loop ends it doesnt
do anything it doesnt call onmeasure etc.

Please help me where I am doing wrong.

--



help on graphics from newbie

by Gaunt Face » Sat, 27 Feb 2010 05:17:17 GMT


 What I think you need to do is set up a Handler between the main
activity and your background thread('s).

Basically a Handler is a way to communicate between the main UI thread
and background threads, this way anything that must be done on the UI
event can be achieved by sending a message from the background thread
through the handler, you then override the handleMessage function in
the Handler and your good to go:

    mUIHandler = new Handler() {

                public void handleMessage(Message msg)
                {
                        if(msg.arg1 == SOME_CONSTANT)
                        {
                                       // Do Stuff Here
                        }
                }

        };


Then in your background thread you'd do something like:

                                Message msg = Message.obtain();
                                msg.arg1 = SOME_CONSTANT;

                                mUIHandler.sendMessage(msg);

Hope that helps,
Matt




--


Sponsored Links


help on graphics from newbie

by social hub » Sat, 27 Feb 2010 05:26:23 GMT


 in this case I am doing inside a surfaceview does the same apply even for
surfaceview.

Thanks for your feedback.





>



help on graphics from newbie

by SoftwareForMe.com SoftwareForMe.com » Sat, 27 Feb 2010 05:58:18 GMT


 Yes. This is perfect for use in the Surface view.

The first code snippet can go anyplace. The relayout call should go where
the // Do Stuff Here comment is.

The second bit should go where you want to call relayout at (but can't
because it's in the background thread).






>>



Other Threads

1. Android Devs/Interested Folk in Ireland

Hi guys,

In April I ran two events for iPhone (one in Belfast, one in Dublin)
which attracted a few hundred people to them. Since then we've been
planning another event for later this year and we'd like to open it
out to Android developers (and other platforms too). We've already got
some more interest from iPhone folk, some minor interest from Symbian
as well.

Last time round we had volunteer speakers who talked about their
experiences with the appStore, their current work, the stuff they'd
like to be able to do and for most people it was a great opportunity
to showcase their work.  I think the Android developer marketplace is
sufficiently mature that it should be able to support a similar sort
of event now.

Can folk get in touch with me if they're interested. We're sure to be
running this in Belfast -  Dublin or maybe Derry will depend on
interest.

Matt

--~--~---------~--~----~------------~-------~--~----~

2. simplecursoradapter updatining the listview

hai guys use two activities and when you press button with in the
listener of button for insert u call other activity which displays the
List View containing listadapter

--~--~---------~--~----~------------~-------~--~----~

3. Play Audio File (stored in files directory)

4. Installation Android on Eclipse

5. What is qmg file (found in my android system)

6. Reference Guide

7. Implementing L2CAP