Java 如何以实用的方式关闭FinestWebView?
我正在使用,我想在自动加载特定url后关闭它。我没有找到任何方法来关闭它 我试过:Java 如何以实用的方式关闭FinestWebView?,java,android,webview,Java,Android,Webview,我正在使用,我想在自动加载特定url后关闭它。我没有找到任何方法来关闭它 我试过: FinestWebView.Builder fn = null; fn = new FinestWebView.Builder(getActivity()). setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.
FinestWebView.Builder fn = null;
fn = new FinestWebView.Builder(getActivity()).
setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit).setWebViewListener(new WebViewListener() {
@Override
public void onPageStarted(String url) {
super.onPageStarted(url);
if (url.equalsIgnoreCase(//myurl//)) ;
{
//here i want to close
}
}
}).backPressToClose(true);
;
fn.show(url);
及
过程很简单,只需查看当前可见的活动,检查InAnse,如果匹配FinestWebViewActivity,则完成
final FinestWebView.Builder builder = new FinestWebView.Builder(AddBalanceActivity.this);
builder.titleDefault("Recharge Evaly Account")
.webViewBuiltInZoomControls(true)
.webViewDisplayZoomControls(true)
.dividerHeight(0)
.gradientDivider(false)
.setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit,
R.anim.activity_close_enter, R.anim.activity_close_exit)
.setWebViewListener(new WebViewListener() {
public void onPageFinished(String url) {
super.onPageStarted(url);
if (url.contains("url you want to match")){
if(getApplicationContext() instanceof FinestWebViewActivity)
((FinestWebViewActivity)getApplicationContext()).finish();
}
}
}).show(purl);
final FinestWebView.Builder builder = new FinestWebView.Builder(getActivity());
builder.setWebViewListener(new WebViewListener() {
@Override
public void onPageStarted(String url) {
super.onPageStarted(url);
if (url.startsWith(Constants.THANK_YOU_PAGE)) {
Activity webViewActivity = AppController.getInstance().getCurrentWebViewActivity();
if (webViewActivity != null) {
webViewActivity.finish();
}
}
}
});
builder.show(url);
final FinestWebView.Builder builder = new FinestWebView.Builder(AddBalanceActivity.this);
builder.titleDefault("Recharge Evaly Account")
.webViewBuiltInZoomControls(true)
.webViewDisplayZoomControls(true)
.dividerHeight(0)
.gradientDivider(false)
.setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit,
R.anim.activity_close_enter, R.anim.activity_close_exit)
.setWebViewListener(new WebViewListener() {
public void onPageFinished(String url) {
super.onPageStarted(url);
if (url.contains("url you want to match")){
if(getApplicationContext() instanceof FinestWebViewActivity)
((FinestWebViewActivity)getApplicationContext()).finish();
}
}
}).show(purl);