Android : how to execute AsyncTask?

ABINEEEXCUMMA

New Member
I have to load XML data in my app, I'm doing that in a subclass of my activity class extending AsyncTask like this :\[code\]public class MyActivity extends Activity { ArrayList<Offre> listOffres; private class DownloadXML extends AsyncTask<Void, Void,Void> { protected Void doInBackground(Void... params) { listOffres = ContainerData.getFeeds(); return null; } } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_liste_offres); DownloadXML.execute(); // Problem here ! for(Offre offre : listOffres) { // etc } }}\[/code\]I don't know how to use execute() here, I have the following error :\[quote\] Cannot make a static reference to the non-static method execute(Integer...) from the type AsyncTask\[/quote\]I guess some parameters but what ?Thank you.
 
Back
Top