3
I have a "Runnable" method that executes in a new Thread a certain method to update my list.
Every time I call this "Runnable", I’m creating a new Thread, which for me is not very positive...
How can I do the same thing using an Asynctask?
Follow my method:
public void atualizaLista(){
Thread t = new Thread("Thread1") {
@Override
public void run() {
runOnUiThread(new Runnable() {
public void run() {
// Atualiza lista
atualiza();
}
});
}
};
t.start();
}
The class Asynctask also creates a new Thread. Here I give a small explanation between choosing one class or another.
– ramaral