du kan bruge AsyncTask..
tjek denne arbejdskode...
for at kalde AsyncTask brug ny BackGround().execute();
private class BackGround udvider AsyncTask
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(Instructions.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// here is your background process...
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if (pDialog.isShowing())
pDialog.dismiss();
}
}