如何在调用一次后刷新从 Android tabview 调用的 webview
如何在调用后刷新从 Android tabview 调用的 webview,例如,如果我调用与 tabview 连接的活动,那么一旦调用它就不会刷新。有什么办法可以做到这一点,
代码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
TabHost tabHost = getTabHost();
tabHost.addTab(createTab1(aActivity.class, "a", "", R.drawable.ic_tab_a));
tabHost.addTab(createTab2(bActivity.class, "b", "", R.drawable.ic_tab_b));
tabHost.addTab(createTab3(cActivity.class, "c", "", R.drawable.ic_tab_c));
tabHost.setCurrentTab(0);
}
How to refresh the webview which is called from Android tabview after once called, for example if i called an activity that is connected with the tabview then it does not refreshes once its called. Is there any way to do that,,
Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
TabHost tabHost = getTabHost();
tabHost.addTab(createTab1(aActivity.class, "a", "", R.drawable.ic_tab_a));
tabHost.addTab(createTab2(bActivity.class, "b", "", R.drawable.ic_tab_b));
tabHost.addTab(createTab3(cActivity.class, "c", "", R.drawable.ic_tab_c));
tabHost.setCurrentTab(0);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以完整的代码将是
newButton.setOnClickListener(new View.OnClickListener() {
我在堆栈溢出上找到了这个答案。它应该肯定可以工作。
或者尝试这个
实现一个 WebViewClient,覆盖 shouldOverrideUrlLoading() 来告诉 Android 你想要什么通过 setWebViewClient() 将 WebViewClient 附加到 WebView。
so the full code would be
newButton.setOnClickListener(new View.OnClickListener() {
I found this answer on stack overflow.And it should work for sure.
or try this one
Implement a WebViewClient, overriding shouldOverrideUrlLoading() to tell Android what you want to do on link clicks. Attach that WebViewClient to the WebView via setWebViewClient().