Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:03:12+00:00 2026-05-31T06:03:12+00:00

I’ve been looking about for a proper explanation about javascript’s relationship with the android

  • 0

I’ve been looking about for a proper explanation about javascript’s relationship with the android WebView. Can anyone tell me: if I an HTML page online and all the required javascript files to make what I need work on that HTML page, can I port it to android.

For example could I move the javascript files onto the android app local folder ( if so: which folder? ) and call a function from in the app. Then could I get the result of the javascript function from one of those files?

If anyone has any tutorials or resources related to this could you point me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:03:14+00:00Added an answer on May 31, 2026 at 6:03 am

    When you have a WebView you can set a Webchormeclient or a Webviewclient, the webchromeclient will be similar to your chrome desktop browser. The other option is to use a Webviewclient this webview client can be configurated as you wish, you can add an “interface” to call Javascript functions from your java code, or java functions from your Javascript code.
    The interface is a class and can be something like this:
    final class JavaScriptInterface {

            public void myalert(String message){
                new AlertDialog.Builder(wview.getContext()).setMessage(message).setNeutralButton("Ok",new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).show();
    
            }
    

    The webview has a method to “attach” this class to the Javascript:

    wview.addJavascriptInterface(new JavaScriptInterface(), "interface);
    

    Once you have add the JavascriptInterface, you can call the method myalert(“hi”) from the Javascript code, to do so, you will have to do something like:

    window.interface.myalert("hi") //This is called in the Javascript
    

    if you want to call a Javascript from the Java code you can do something like this:

    wview.loadUrl("javascript:changeValues('"+name+"','"+id+"')");//this will call a Javascript function called changeValues, and will pass to variables (name, id)
    

    To sum up, the webchromeclient is easier to use but the webviewclient allows you more configuration. Before, maybe you want to read about phonegap which is a framework to devlop Webapps x-platform.
    Hope you that this fast explanation helps you a little.

    PS: With the second option you can store all that you need in the sdcard.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
Does anyone know how can I replace this 2 symbol below from the string
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.