My code:
final WebView webView1 = (WebView)findViewById(R.id.example);
webView1.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent(Ads.this, General.class);
startActivity(intent);
finish();
return false;
}
});
webView1.getSettings().setJavaScriptEnabled(true);
webView1.setBackgroundColor(Color.TRANSPARENT);
StringBuilder htmlData = new StringBuilder("<html>");
htmlData.append("<head></head>");
htmlData.append("<body style='margin:0;padding:0;'>");
htmlData.append("banner from my websive with link");
htmlData.append("</body>");
htmlData.append("</html>");
webView1.loadData(htmlData.toString(),"text/html", "ISO 8859-1");
Please, where I have a problem?
How I start first Intent and after browserver window?
PS: I don't know why but if I click on webview, intent will start 5 times in same time.
Try use this code
webView1.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
Intent intent = new Intent(Ads.this, General.class);
startActivity(intent);
finish();
}
return true;
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.