Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i use webView.addJavascriptInterface to handle click event from html elemnt
but When I left from activity and then go to activity again, not work!

HTML
<img src="../images/image_1.jpg" id="1" alt="" onclick="hadi.work(1);">


Java
webShower.addJavascriptInterface(new Object()
        {

            public void work(int id)
            {
                
                Toast.makeText(getApplicationContext(), """ + i, Toast.LENGTH_SHORT).show();

            }

        }, "hadi");
Posted
Updated 20-Jul-15 0:28am
v5

1 solution

I resolved problem.
i was defined javascript enable after load url.
must define before loadUrl
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900