How to update View object on main thread by background thread

by Anh Khoa Nguyen Pham » Wed, 04 Mar 2009 15:56:06 GMT


Sponsored Links
 serTask class is useful but in this case, if i want to fix my problem in my
code, can you help me to do that?
I really appreciate your help !
Thanks,
NPAK

On Wed, Mar 4, 2009 at 2:15 PM, Clay <claytan...@gmail.com> wrote:


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



How to update View object on main thread by background thread

by Anh Khoa Nguyen Pham » Thu, 05 Mar 2009 12:00:31 GMT


 i Clay,

Thank for your help so much,
Now, i can fix my problem.I insist to find way to fix my problem in my code
because it will makes my skill better than using someone's code. But next
time, i will use UserTask to do that.

Best regard,
NPAK

On Thu, Mar 5, 2009 at 9:54 AM, Clay <claytan...@gmail.com> wrote:


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


Sponsored Links


How to update View object on main thread by background thread

by Anh Khoa Nguyen Pham » Thu, 05 Mar 2009 12:05:58 GMT


 i Clay,

Thank for your help so much,
Now, i can fix my problem.I insist to find way to fix my problem in my code
because it will makes my skill better than using someone's code. But next
time, i will use UserTask to do that.

Best regard,
NPAK

On Thu, Mar 5, 2009 at 9:54 AM, Clay <claytan...@gmail.com> wrote:


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



How to update View object on main thread by background thread

by Dianne Hackborn » Thu, 05 Mar 2009 13:10:51 GMT


 o just do something every so often, you really shouldn't use a thread (or
UserTask), just Handler.sendDelayedMessage(), which is a lot lighter-weight.

On Wed, Mar 4, 2009 at 8:05 PM, Anh Khoa Nguyen Pham <npak...@gmail.com>wrote:



--
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support. All such questions should be posted on public
forums, where I and others can see and answer them.

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



Other Threads

1. createSurface fails with out-of-memory exception

I'm creating a screen with about 120 TextViews in a grid pattern -
about 3 screens worth. The TextViews are arranged in TableRows inside
a TableLayout inside a ScrollView. I'm not using a GridView because it
doesn't scroll correctly for my application.

In the Allocation Tracker I can see that my onCreate takes about 46K
of memory, which seems modest. However, I'm getting an out-of-memory
exception from inside the Android framework in the createSurface
method.

I'm trying to figure out how to diagnose the memory usage of
createSurface to see which of my Views is chewing up all the memory.
Maybe it's a programming error on my part or maybe it's a bug in the
Android framework. I just can't tell.

The exception causes the application to be killed, which aborts the
Allocation Tracker so I can't really see what's going on inside
createSurface.

I'm thinking maybe I should override createSurface and surround the
call to the super with a catch block. Then I can stop it in the
de{*filter*} before the process is killed. Can anyone think of a more
clever approach? Has anyone else diagnosed createSurface memory
problems? Is there a reference document that describes how it works?

-- 

2. Using Allocation Tracker in DDMS

I have an Activity that is running out of memory in CreateSurface. The
logcat looks like this:

10-04 17:55:52.574: ERROR/SurfaceFlinger(1086): createSurface()
failed, generateId = -12
10-04 17:55:52.574: WARN/WindowManager(1086): OutOfResourcesException
creating surface
10-04 17:55:52.574: INFO/WindowManager(1086): Out of memory for
surface!  Looking for leaks...
10-04 17:55:52.574: WARN/WindowManager(1086): No leaked surfaces;
killing applicatons!
10-04 17:55:52.574: WARN/ActivityManager(1086): Killing processes Free
memory at adjustment 0

I'm trying to use DDMS to figure out what's going on but when the
application gets killed DDMS aborts the Allocation Tracker.

Is there a way to cause the application to do a core dump and is there
a tool for analyzing dumps?

I have SDK version 8, which does not allow simultaneous use of DDMS
and the Eclipse de{*filter*} so I need to get creative.

-- 

3. Programmatically switching GPS on/off (how do they do it??)

4. Changing the width of an ImageView

5. how do I force sendDownUpKeyEvents(MEkeyEventCode) to complete

6. USB Video on an OMAP based board

7. Porting to FPGA (Newbie)