I am working with TypeForm
forms that I show them through WebView
in my application.
What I'm trying to do is close the WebView
after they finish the form.
When the form is completed on the screen, a text appears thanking. How can I take that text and in the case that appears close the WebView.
This is the code I have made.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_type_form_rest_of_day);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle("");
Bundle datos = this.getIntent().getExtras();
assert datos != null;
user = datos.getString("email");
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.setWebViewClient(new WebViewClient());
if (Locale.getDefault().getLanguage().equals("en")) {
myWebView.loadUrl("http://cliente.typeform.com/to/U0mcRV?user=" + user);
}else{
myWebView.loadUrl("http://cliente.typeform.com/to/U7o3PU?user=" + user);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
} else
return super.onOptionsItemSelected(item);
}
Greetings!