Did you use a different user interface thread? You should not use more than 1 UI thread and make it look like a sandwich. This will result in a memory leak.
I solved a similar problem 2 days ago ...
In short: the main thread can have many UI threads to do several work, but if there is one subflow inside it containing the UI thread, the UI thread may not have completed its work before its parent thread has already completed its work. work, it causes memory leaks.
For example ... for a Fragment & UI application ... this will lead to memory leaks.
getActivity().runOnUiThread(new Runnable(){ public void run() {//No.1 ShowDataScreen(); getActivity().runOnUiThread(new Runnable(){ public void run() {//No.2 Toast.makeText(getActivity(), "This is error way",Toast.LENGTH_SHORT).show(); }});// end of No.2 UI new thread }});// end of No.1 UI new thread
My solution is rearranging as shown below:
getActivity().runOnUiThread(new Runnable(){ public void run() {//No.1 ShowDataScreen(); }});// end of No.1 UI new thread getActivity().runOnUiThread(new Runnable(){ public void run() {//No.2 Toast.makeText(getActivity(), "This is correct way",Toast.LENGTH_SHORT).show(); }});// end of No.2 UI new thread
for reference.
I am Taiwanese, I am happy to answer here again.
Jackie_Hung Nov 14 '14 at 4:38 a.m. 2014-11-14 04:38
source share