passing value to webview from an activity in andro

2019-09-12 15:23发布

问题:

I have one activity to produce some result respect with user input.

my xml page is like one text view, button and a webview.

when user input some date and clicks the button then generate one value. also when loading page the web view loads a local html page from asset folder and its showing some default value.

what my need is when new value generates respect with button click i need to change the html pages value also.

How to I pass value to web view. pblm is I don't want to pass value to while loading I need to pass value at some intermediate stage because default its already showing one value.

how to make this. I appreciate it if anyone can help.

回答1:

You can have validation by using integer and boolean depending on user's event and load the local html file from assert like

webview.loadUrl("file:///android_asset/aboutcertified.html"); 


回答2:

I have a small doubt regarding your question. sorry ,wht actually u want achieve ?based on ur value do u want to load a seprate html file in the webview or u want to change any value in the web page which is already loaded in the webview by default.May be this link will be useful for you http://android-er.blogspot.in/2011/10/call-javascript-inside-webview-from.html