Skip to content Skip to sidebar Skip to footer

How To Pass String In Webview Url From Edittext

I have two activity MainActivity.java and WebViewActivity.java in MainActivity there is a edittext and a button. Now i want if i enter any string in edittext and after button click

Solution 1:

Use this code while starting activity:

MainActivity :

Intent intent = newIntent(MainActivity.this, WebViewActivity.class);
intent.putExtra("text", inputUrl.getText().toString());
startActivity(intent);

To fetch the value :

WebViewActivity :

StringgetStringFromEdittext= getIntent().getExtras().getInt("text");

Post a Comment for "How To Pass String In Webview Url From Edittext"