Thanks for the help. That works :)
On Fri, Dec 9, 2011 at 7:24 PM, Jonathan Pryor-2 [via Mono for Android] <
ml-node+s1047100n506278...@n5.nabble.com> wrote:
> On Dec 9, 2011, at 12:52 PM, Hernani Delindro wrote:
>
> > Hello, I'm still new to Mono for Android, and C# in general, but I would
> like
> > some help on how to "translate" the following code to m4a, because I'm
> > having trouble understanding with how listeners and callbacks are
> > implemented in m4a.
> >
> > webview.SetWebChromeClient(new WebChromeClient() {
> > public void OnProgressChanged(WebView view, int progress)
> > {
> > activity.SetTitle("Loading...");
> > activity.SetProgress(progress * 100);
> >
> > if(progress == 100)
> > activity.SetTitle(Resource.String.app_name);
> > }
> > });
>
> That is an anonymous inner class, which C# doesn't support. Instead, you
> need to turn it into a "normal" class (either at top-level or a nested
> type, doesn't really matter):
>
> class WebChromeClientDelegator : WebChromeClient {
> public Action<WebView, int> ProgressChanged;
>
> public override void OnProgressChanged (WebView view, int
> newProgress)
> {
> if (ProgressChanged != null)
> ProgressChanged (view, newProgress);
> }
> }
>
> // ...
> webview.SetWebChromeClient (new WebChromeClientDelegator () {
> ProgressChanged = (view, progress) => {
> activity.SetTitle ("Loading...");
> activity.SetProgress (progress * 100);
> if (progress == 100)
> activity.SetTitle
> (Resource.String.app_name);
> },
> });
>
> - Jon
>
> _______________________________________________
> Monodroid mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5062788&i=0>
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://mono-for-android.1047100.n5.nabble.com/How-to-use-OnProgressChanged-in-m4a-tp5062534p5062788.html
> To unsubscribe from How to use OnProgressChanged in m4a?, click
> here<http://mono-for-android.1047100.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5062534&code=dmFtcGlyZXZvcmFkb3JAZ21haWwuY29tfDUwNjI1MzR8MTc1OTk0NzAwMg==>
> .
> NAML<http://mono-for-android.1047100.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context:
http://mono-for-android.1047100.n5.nabble.com/How-to-use-OnProgressChanged-in-m4a-tp5062534p5063005.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid