view source code html

hello.
i am view sourse code htmlpage to string no help in mono for android plase help

Posts

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    @mfaridi - friendly advice. If you want to get effective help from us, you will have to start explaining your questions/issues more clearly. Your question above just does not give us anything to work with at all.

  • mfaridi1mfaridi1 GBMember

    plase help

  • WilleWille DEMember ✭✭
    edited June 2013

    "please help" is not what Chris ment by "starting explaing questions/issues more clearly"

    The more detailed information you offer to the community, the more likely it is, that someone will provide usefull solution to your problem.

  • mfaridi1mfaridi1 GBMember

    This is my problem
    Only context ):

  • WilleWille DEMember ✭✭

    context == information

  • mfaridi1mfaridi1 GBMember

    After further explain?

  • CheesebaronCheesebaron DKInsider, University mod

    I must ask. What have you tried?

  • mfaridi1mfaridi1 GBMember

    Error 1 The best overloaded method match for 'tar.activWeb.Foo.Foo(string)' has some invalidarguments.
    Error 2 Argument 1: cannot convert from 'tar.activWeb' to 'string.

    ` webview.AddJavascriptInterface(new Foo(this), "MY_JS");

        }
    
        class Foo : Java.Lang.Object
        {
            string html;
            public Foo(string html) {
                html = htmlview;
        }`
    

    plase help

  • WilleWille DEMember ✭✭
    edited June 2013

    I think a community lives from discussions and helping each other, but just saying "give me some code" "solve my problem" does not work.
    Noone can guess what your problem is, what you have tried, where you did fail, whatever.

    So some information, e.g.
    1. What is the context, what do you want to do with your app. What are the conditions etc..
    2. What exactly is the problem - maybe with some significant sourcecode or stacktrace
    3. When does this problem occure.
    4. What have you tried to solve it yourselfe (searching google, trying solutions from e.g. stackoverflow, xamarin documentation...)

  • mfaridi1mfaridi1 GBMember

    I want the html code of a web page to read

  • m1faridim1faridi AFMember

    We tried it did not come to
    3 working days
    please help

  • m1faridim1faridi AFMember
    edited June 2013
    public void showHTML(String html)// string error
    {
    
        txtcode.setText(html);
    }
    
  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    Sorry friend, I think a language/understanding gap is in our way. We do not know what you are trying to ask.

    Perhaps you can find someone to translate for you, or maybe even try using Google Translate?

  • m1faridim1faridi AFMember

    yes google translate

  • m1faridim1faridi AFMember
    edited June 2013
  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    Ok, so it seems you are still trying to extract HTML from a WebView. In your other thread about this I provided this link that explains how to do that (you just need to convert to C#): http://stackoverflow.com/questions/8200945/how-to-get-html-content-from-a-webview

  • m1faridim1faridi AFMember

    class MyJavaScriptInterface
    {
    @SuppressWarnings("unused")

    public void showHTML(String html)// line error string
    {
    
        txtcode.setText(html);
    }
    

    }

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭
    @SuppressWarnings("unused")
    

    You need to get rid of this part.

  • m1faridim1faridi AFMember

    plase convert code.

    wvbrowser.addJavascriptInterface(new MyJavaScriptInterface(),"HTMLOUT");
    `class MyJavaScriptInterface
    {
    @SuppressWarnings("unused")
    public void showHTML(String html)
    {

        txtcode.setText(html);
    }
    

    }
    `
    to mono for android string html erore

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭
    edited June 2013

    Sorry mfaridi, unless you have a clear question, I cannot help you. I gave you all the pieces of the puzzle already. If you're still stuck, it's time to read up on C# and Android, follow some guides, look at some sample apps, and then make another attempt.

  • m1faridim1faridi AFMember

    tanks Chris Honselaar

  • mfaridi1mfaridi1 GBMember

    Thanks to all friends

            WebView view = FindViewById<WebView> (Resource.Id.web);
    
            view.Settings.JavaScriptEnabled = true;
    
            view.SetWebChromeClient (new WebChromeClient ());
    
            view.AddJavascriptInterface (new Foo (this), "Foo");
    
            view.LoadUrl ("https://google.com");
    
            btn.Click += delegate {
    
                view.LoadUrl ("javascript:window.Foo.Bar('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
    

    code javascriptinteface class Foo : Java.Lang.Object

    {
    
        public Foo (Context context)
    
        {
    
            this.context = context;
    
        }
    
    
    
        public Foo (IntPtr handle, JniHandleOwnership transfer)
    
            : base (handle, transfer)
    
        {
    
        }
    
    
    
        Context context;
    
    
    
        [Export]
    
        // to become consistent with Java/JS interop convention, the argument cannot be System.String.
    
        public void Bar (Java.Lang.String message)
    
        {
    
            Console.WriteLine ("Foo.Bar invoked!");
    
            Toast.MakeText (context, "This is a Toast from C#! " + message, ToastLength.Short).Show ();
    
        }
    
    
    }`
    
Sign In or Register to comment.