Saturday, March 8, 2014
Android service ANR ask questions
I created a service, is designated to run in the new process space, I need to perform an operation in the service of the cycle , so the service has not return. After this period of time, my service is automatically stopped, not running, because the space in the new process, nor can breakpoint debugging, do not know why, through time, the preliminary judgment is ANR. I want to stop the cycle of service to perform this operation. After the experiment, the operation can not run in the sub-thread, a construction sub-thread, you collapse out, so this operation can not be performed by the child threads. I ask how to solve it? Thank you<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
I le a go, this is how the CSDN, experts are gone ......
Reply:
How could not create a child thread to handle time-consuming operations are not handled inside the service, because it is quite a process service interface, which is not allowed in this time-consuming data processing, data processing takes only In creating a new thread inside.
Reply:
service can not be put inside the time-consuming operation, service does not mean that one thread, if done for a long time-consuming operation, the service which serves as a thread to complete it.
Reply:
To be honest, I can hardly believe why not create a child thread to operate. I framebuffer operations, c encapsulated into the library to get data from the framebuffer, and then returned to the java layer processing. The current situation is, as long as the call in the main thread, ok, no problem. The same code, as long as a new thread to start operation, the program has been dead logocat interaction data, chipping away until the program.
Reply:
Ah, my thoughts are also with the new thread to operate, but to create a new thread to operate, the program will collapse out of the ah, the other operations are possible with the new thread to handle this framebuffer, a new thread, procedures should be dead! I checked the code countless times, I do not know where the problem
Reply:
Code, the code
Reply:
http://topic.csdn.net/u/20111026/11/36c08699-b533-4a18-adc3-436a0a6ca503.html
17th floor is the code I posted. I've been asked countless times, remain unanswered ah ....
Reply:
Yeah can not can not create child threads. . Estimate your service problems. In front of a lot of guys say, you cycle into service. Will be blocked threads.
Reply:
Even if I do not have service, I created a sub-thread in the UI thread to operate, the program will collapse out. Tried numerous times. It's really hard to believe, but the truth is I really met, code page looked and looked, could not find the problem, do not know if the framebuffer related to child thread is not allowed to operate. This issue is destined to die I toss has N long. Collapse .....
Reply:
Service does not block
Reply:
So you have to perform, there is no time gap ah, no words will account for over system resources, and certainly he died.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment