I'm creating some adapters in my application and I've had this doubt in a problem I'm having.
I have a type code:
public class ActivityCompra extends AppCompatActivity {
Adapter a;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_compra);
//...
Thread busca = new Thread();
busca.execute();
fazOperacao3();
}
private class Thread extends AsyncTask<Void, Void, Boolean> {
@Override
protected void onPreExecute(){
//...
}
@Override
protected Boolean doInBackground(Void... params) {
//...
}
@Override
protected void onPostExecute(Boolean ok){
if(ok){
a = new Adapter();
lista.setAdapter(a);
cancel(true);
fazOperacao1();
fazOperacao2();
}
}
}
}
The functions fazOperacao1()
, fazOperacao2()
and fazOperacao3()
are executed before the view of ListView
is mounted, and only then getView is called to set the layout components.
I need to perform these operations once the view is already set up and I'm not sure how to do this.
I think it's a very simple thing but I'm having a lot of trouble.