As I see, you are using a Webservice to retrieve your data, so this is not really a MD thing, it's a .net thing, Webservices doesn't have a mechanism for progress indication.
A Webservice exectutes remote functions and retrieves results, is not like downloading a file. But, of course, you can always construct by hand your service query and then use a httpwebrequest to retrieve the data, in this way you will have information about the transfer. Another pssibility can be to split the result in chunks and download it via sucessive calls to a remote function, so when a call is finished you know how much data you have downloaded, can inform to the user and request another chunk, but this is really ineffective because the service encapsulation. Cheers. Enviado desde mi iPad El 08/03/2013, a las 07:53, jalborres <[email protected]> escribió: > am new in Android Programming.. I'M using Mono for android.. I want to made > a progressdialog that show the progress when i'm importing data. I use > Asynctask.. Anyone can help how to make my progress dialog show the > progress. Or else any suggestion of what can be other possible way in making > this. I already post it at http://stackoverflow.com/q/15285844/2146883 but i > think no one know mono for android.. > > public class importData : AsyncTask > { > > private ProgressDialog _progressDialog; > WebReference.Service1 service = new WebReference.Service1(); > private Context _context; > > > > > public importData(Context context) > > { > > _context = context; > > > > } > > protected override void OnPreExecute() > > { > // i make a horizontal progressdialog, i want to see the progress while > importing > > base.OnPreExecute(); > _progressDialog = new ProgressDialog(_context) { Indeterminate = false }; > _progressDialog.SetMessage("Please wait..."); > _progressDialog.SetProgressStyle(ProgressDialogStyle.Horizontal); > _progressDialog.Max = 806; > _progressDialog.Progress = 0; > _progressDialog.Show(); > > } > > protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] > @params) > > { > try > { > //My background Code in Importing Data > return true; > } > catch (Exception ex) > { > //When has an error return false > return false; > } > > > } > > protected void OnProgressUpdate() > { > base.OnProgressUpdate(); > //What i'm going to put in this part > > } > > protected override void OnPostExecute(Java.Lang.Object result) > > { > base.OnPostExecute(result); > _progressDialog.Hide(); > _progressDialog.Dismiss(); > bool dd = (bool)result; > if (dd) > { > > > //Toast.MakeText(this, "Importing data completed", > ToastLength.Short).Show(); > Android.App.AlertDialog.Builder builder = new AlertDialog.Builder(_context); > AlertDialog ad = builder.Create(); > ad.SetTitle("Info"); > ad.SetIcon(Android.Resource.Drawable.IcDialogInfo); > ad.SetMessage("Importing deals completed"); > ad.SetButton("OK", (s, e) => { }); > ad.Show(); > } > else { > > Android.App.AlertDialog.Builder builder = new AlertDialog.Builder(_context); > AlertDialog ad = builder.Create(); > ad.SetTitle("Error"); > ad.SetIcon(Android.Resource.Drawable.IcDialogAlert); > ad.SetMessage("Failed"); > ad.SetButton("OK", (s, e) => { }); > ad.Show(); > } > } > > > } > > > > -- > View this message in context: > http://mono-for-android.1047100.n5.nabble.com/How-can-i-update-the-progress-in-the-onProgress-Update-in-using-ASYNCTask-in-mono-for-Android-tp5713006.html > Sent from the Mono for Android mailing list archive at Nabble.com. > _______________________________________________ > Monodroid mailing list > [email protected] > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid _______________________________________________ Monodroid mailing list [email protected] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
