He had designed a app, there are two threads, a thread is read sensor data, another thread is send instructions to the hardware,
When meet certain conditions, the app via bluetooth to send hardware instruction execution operation, threads to execute commands sent, at the same time perform the thread to read data, found the thread after a period of time to read the data execution stopped work, in a period of time the process is out of the,
Excuse me, how to solve this problem??
CodePudding user response:
Nobody can help you solve, their call log breakpoints, slowly debuggingCodePudding user response:
Ha ha, you're asking the right person you the memory leaks, I recently in the writing project the solution to this is my https://blog.csdn.net/u012922981/article/details/105791233 you put "when meet certain conditions, the app via bluetooth to send hardware operating instruction execution" this operation on the public void handleMessage (Message MSG) {Super. HandleMessage (MSG);
OperationActivity activity=mWeakReference. The get ();
If (the activity!=null) {
If (MSG. What==1) {
Activity. _handleWeightChanged ();
I do is to do a page refresh myself and meet the conditions of network operation request
}
}
}
CodePudding user response: