I have an Android application with 2 activities. Each activity has an AsyncTask that communicates with a server using UDP.
public class MainPostTask extends AsyncTask<String, Integer, String> {
@Override
protected String doInBackground(String... params)
{
..... udp comunication here
}
}
I change between these two activities every 20 seconds.
e.g.:
Intent it = new Intent(this, MainActivity.class);
startActivity(it);
The other PostTask is omitted to reduce the text.
After 3 hours, the Android becomes very slow. Sometimes is very hard to close the application. I am sure that I am finishing the AsyncTask before changing activity.
Do you have any idea what is going on? How can I profile the Android to see the memory/cpu and etc?
I also use Log.d(). When I plug the cable all the messages buffered are output to the logcat. Do you think this log messages are causing the problem?
Best regards, Andersan.