[android-developers] Re: service start and ui hanging

2009-03-13 Thread Streets Of Boston
Hi Bob, Your code snippet is not enough to give you some more info. E.g. how does backgroundRefresh2 looks like (it public void run() implementation). Based on its name 'backgroundRefresh2': does it access View-s and modify these view (e.g. update text-view, images, etc.)? If so, that may

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Bob
Thanks for your quick response. It doesn't access or modify any views. It accesses the context to read in some raw resources and writes to the sqllite database also via context. On Mar 13, 9:32 am, Streets Of Boston flyingdutc...@gmail.com wrote: Hi Bob, Your code snippet is not enough to

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Dianne Hackborn
At the very least, you should include (and look at!) the stack crawl of the crash. That will usually tell you all you need to know about why it crashed. The stack crawl is in the log. On Fri, Mar 13, 2009 at 9:39 AM, Bob bshumsk...@yahoo.com wrote: Thanks for your quick response. It doesn't

[android-developers] Re: service start and ui hanging

2009-03-13 Thread andrew
Thanks for your quick response. It doesn't access any other views. It does access the context object so as to work with the sqlite dbs. On Mar 13, 10:32 am, Streets Of Boston flyingdutc...@gmail.com wrote: Hi Bob, Your code snippet is not enough to give you some more info. E.g. how does

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Bob
Thanks, I'll look more at the logs for crash issue. But regardless of the crash, am I correct in thinking that if I call a service it should do its processing in the background and the main UI thread should immediately update? For this does it matter whether I start the service from a

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Dianne Hackborn
Um... it sounds like you are just doing a lot of work in the main thread, and getting an ANR dialog. Don't do that. :) If you have lots of work to do, do it in a background thread. All Service callbacks happen on the main thread. On Fri, Mar 13, 2009 at 11:16 AM, Bob bshumsk...@yahoo.com

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Bob
If you have lots of work to do, do it in a background thread. Thanks, I thought I running on a different thread by calling the service from a background thread. Have I done this incorrectly or should I not be using the context object? public void openInitialThread() { Thread

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Mark Murphy
Bob wrote: Thanks, I thought I running on a different thread by calling the service from a background thread. Personally, I prefer the pattern of starting the service on the UI thread but then having the service immediately start up a background thread to do its work. That way, the service

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Dianne Hackborn
startService() tells the system to start the service. The Service callbacks are still made on the main thread, as always. On Fri, Mar 13, 2009 at 12:22 PM, Bob bshumsk...@yahoo.com wrote: If you have lots of work to do, do it in a background thread. Thanks, I thought I running on a

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Bob
I'm sorry, I don't understand what this means. I have no callbacks. The service inserts some data into the filesystem and then exists. How do I this so the UI won't hang while the processing is going on? On Mar 13, 2:51 pm, Dianne Hackborn hack...@android.com wrote: startService() tells the

[android-developers] Re: service start and ui hanging

2009-03-13 Thread Dianne Hackborn
All of the callback methods on Service, such as onStart(), happen in the main UI thread. If you have a long job to do, use the Thread class to do it in another thread. Semantically this is the same as the Activity callbacks. On Fri, Mar 13, 2009 at 4:48 PM, Bob bshumsk...@yahoo.com wrote:

[android-developers] Re: service with a UI

2008-12-31 Thread Sarath Kamisetty
Hi, The service component of my application needs to do certain tasks at some scheduled time in future. The task list itself is populated by an activity (of the same application) along with the exact date time the task should be carried out. When there are no tasks, service can stop running.

[android-developers] Re: service with a UI

2008-12-31 Thread Mark Murphy
Sarath Kamisetty wrote: I was wondering if android has UNIX crond style process that can I make use of (programatically). AlarmService. Also, when new task is added or existing one is deleted, the activity needs to notify the service. I looked at AIDL but it seems to be more for

[android-developers] Re: service with a UI

2008-12-29 Thread Mark Murphy
Sarath Kamisetty wrote: My application has two halves - one that interacts with the user and gathers some data and stores it, the other half of it is like service that constantly monitors and processes this data and carries out the user specified actions in the background. How do I develop