开发者

Threads interrupted when new activity is started. Android

I have a slightly strange thing happening in my code atm, which I don't understand... I would much appreciate any input anyone may have.

So here's the issue: In my main Activity I fire a Service, using an Intent, when a button is pressed on screen. The Service instantiates 22 Runnable objects each of which read data constantly from 22 separate flat files. The data is fed into a matrix of objects (64 x 64). In my main Activity I have another button which starts a new Activity to visualises the data in the matrix. So when I press it it accesses the data stored in the objects at the same time as the 22 threads are feeding data into them. It is my understanding this kind of operation is the main reason to use threads! However, when I start the new activity it开发者_C百科 seams to interrupt and/or kill the threads as they no longer print their Log.d messages to logcat...

Is it a case that I need to bind my Activity to my Service to access data that it is processing or are the thread independent of the Service as my common sense would tell me??!

Thanks in advance for any advice!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜