Reputation: 43
I have android application which contain html webpage with one single button. The html file is placed into the asset folder in android. I open html file into the webview. Now, i what want to open the another application which is install in android device by click on the html page button.
Can you please anyone help me how i will do that and also give me the some reference from where i will get some help?
Upvotes: 1
Views: 2783
Reputation: 2575
Firstly set your onclik method of button in html like this.
<input type="submit" name="submit" id="submit_id" onclick="click.performClick();" />
enable javascript your webview
webView.getSettings().setJavaScriptEnabled(true);
after that you can detect this click by this code:
webView.addJavascriptInterface(new Object() {
@JavascriptInterface
public void performClick() {// detected click
Intent i = new Intent(FromActivity.This, DestinationActivity.class);
startActivity(i);
}
}, "click");
Upvotes: 0
Reputation: 4784
I think @Sk Maniruddin is asking how to open another app from a webpage. And the solution to that is using an intent, as the link.
<a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"> Take a QR code </a>
for more information you can look at the doc: https://developer.chrome.com/multidevice/android/intents#example
Upvotes: 2