Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Java by registered user Haps ( 12 years ago )
private class ProgressRunner extends AsyncTask<URL, Integer, Long>
{
protected void onPreExecute()
{
try
{
Log.v("WebservicesCaller", "Try - PreExecute");
dialog = new ProgressDialog(WebservicesCaller.this);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setTitle("Please wait !!!");
dialog.setMessage("Loading data from server. It may take few minutes, please be in network.");
dialog.setCancelable(false);
dialog.setProgress(0);
dialog.setIndeterminate(false);
dialog.show();
System.out.println("Progress shown:::::::::::::::::");
}
catch (Exception e)
{
Log.v("ShowTask", "PreExecute Exception");
e.printStackTrace();
dialog.dismiss();
}
}
@Override
protected Long doInBackground(URL... params)
{
int counter = 0;
GetTasksDB();
counter+=5;
publishProgress(counter);
GetCountriesDB();
counter+=5;
publishProgress(counter);
GetTaskJuriRelation();
counter+=10;
publishProgress(counter);
GetJurisdictionDB();
counter+=20;
publishProgress(counter);
if (update > 0)
{
GetTitleDB();
counter+=30;
publishProgress(counter);
GetResourcesDB();
}
if (request > 0)
{
counter+=30;
publishProgress(counter);
getSharedPreferences(PREFS_NAME, MODE_PRIVATE)
.edit()
.putString(PREFS_UPDATE_DATE, date)
.commit();
}
Log.e("WebservicesCaller", "User-Updated");
return null;
}
protected void onProgressUpdate(Integer... progress)
{
Log.v("WSC", "Progress Update");
dialog.setProgress(progress[0]);
}
protected void onPostExecute(Long result)
{
try
{
Log.v("ShowTask", "TRY - PostExecute" + "Try called::::::::::::");
dialog.dismiss();
Intent intent = new Intent(WebservicesCaller.this, WelcomeScreen.class);
startActivity(intent);
}
catch (Exception e)
{
Log.v("ShowTask", "PostExecute Exception" + "catch called::::::::::::::::::::");
e.printStackTrace();
}
}
}
Revise this Paste