1

I have written an app which can talk to server via background service to send the request and get the response back. If I perform some operation (e.g send request and get response back) around 20-30 times, my application becomes very slow and I can observe it by pressing any button - the response becomes very slow .

If you continuously perform the same operation, after some time a pop up message displays saying "Sorry Activity of the application is not responding".

How can I resolve this issue? It seems like my app consumes more memory, so how can I resolve it OR is there any tool available which can be pluggable with Eclipse and will display the reports of memory consumption of the App, and suggest the leak area.

whostolemyhat
  • 3,107
  • 4
  • 34
  • 50
piks
  • 1,621
  • 8
  • 32
  • 59
  • Check this link for some performance improvement tips https://medium.com/@hammad_tariq/android-application-performance-improvement-tips-c4ec4d045d6d#.ejs55stwu – Developine Jan 26 '17 at 15:35

3 Answers3

4

1.For Memory issue: Eclipse have powerful tool for memory tracking: Memory Analyzer tool Please refer references below for use guide of tips: (Ref.1, 2)

2.For ANR issue: To avoid ANR dialog you can put implement of network service to background implement in worker thread or Asyntask

References:

  1. What Android tools and methods work best to find memory/resource leaks?

  2. How do I discover memory usage of my application in Android?

Community
  • 1
  • 1
NguyenDat
  • 4,129
  • 3
  • 46
  • 46
  • 1
    Thanks for suggesting me to use MAT tool,with the help of this tool i found the memory leak in my app and resolve it successfully. – piks Mar 28 '12 at 10:43
2

You need to remember that this is mobile application. Connection is not always available and haven't constance speed. Try:

  • Setup timeouts for requests
  • Use AsyncTasks to prevent the "wait" message
  • Reduce requests quantity
  • Block the button while is working, to prevent double requests
  • Check everything if there is no loop operations
goodm
  • 7,275
  • 6
  • 31
  • 55
0

Looks like you aren't using Threads right...

Using a service doesn't always mean your app is running in the background and the UI thread is still responsive...

Put everything in a Thread this way your UI will keep being responsive and using a Handler you can interact with the UI thread!

Ferdau
  • 1,524
  • 1
  • 12
  • 21