Improving the performance of an Android application

2

I'm developing an application on Android that receives data from a webservice (Json php).

The structure of the project: To get the data I'm using asynctask, I have a progressbar in the preExecute and in the proExecute it visualizes the data. The 'asynctask' class is called in onCreate ().

Problems: The passage of the data from the webservice to the android takes a lot and progresses too and if the user turns the screen, it restarts the search, and this makes the application annoying.

How do I solve this problem? What is the technique used in applications like WhatsSap or the messanger?

    
asked by anonymous 16.07.2017 / 19:06

1 answer

2

The method you choose to use to load data from a webservice into a background thread will not influence performance. As for the loss of work done, this is characteristic of AsyncTask which is one of the simplest implementations of multitheading on Android and is generally used for faster processing (image decoding, for example) and that there are no problems if the job is reset. For longer processing that does not depend on the state of the Activity, I suggest using Loaders or Services, preferably the latter for you because they are totally independent of the Activity lifecycle.

    
16.07.2017 / 21:18