Home > Mobile >  Android development, multithreading
Android development, multithreading

Time:09-16

Recently do project is intelligent irrigation
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 debugging

CodePudding 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:

refer to the second floor ш е с а й - а й - а й - а й - а й, discusses some related problems of reply:
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
}
}
}

Thank you, I try it??????

CodePudding user response:

Good hard ah,,,,

CodePudding user response:

Try {... } the catch (Exception e) {... } save error log to the local storage, to check the error message,

CodePudding user response:

Thank you, thank you, the good life of peace

CodePudding user response:

Thanks for sharing!!!!!

CodePudding user response:

Thanks for sharing
Give it a try

CodePudding user response:

Very useful, thank you