- How to properly manage code for android application? (for tasks/UI)
- How to separate user interface from code? (use class or packaged)
- How to add items to user interface from background thread/operation (
correct way
)? For example, i have TableLayout. How to properly add rows to that TableLayout? Create custom object (class) for my needs, then add items to object and then loop throughout that object and add items to TableLayout? Pass TableLayout as a reference? - Better is to create separate
class
orpackage
for data gathering? (connecting to data provider, get data, display it to user)
I searched around and found some ways to do background tasks.
- First is AsyncTask. Here is written, that AsyncTasks should ideally be used for short operations (a few seconds at the most.)
- Second I found is Handler.
- Is there another correct ways to do background tasks?
Witch way is correct for data gathering from WEB service (there may be some delays and lags)?
If using Handler
then how to pass data to UI thread?. And in most I am interested in question number 3.
Thanks.