How to pass URL from one activity to another activity?
I also had a look for passing data from one activity to another activity, I'm facing the problem. When I run the program it's passing to second activity but page is blank.
Activity1 code
String url = result[1].toLowerCase();
Intent i = new Intent(getApplicationContext(), choice.class);
i.putExtra("url", url);
startActivity(i);
break;
Second activity:
Bundle extras = getIntent().getExtras();
if (extras != null) {
String url = extras.getString("url");
Toast t7 = Toast.makeText(getApplicationContext(),
"Visiting: " + url, Toast.LENGTH_SHORT);
t7.show();
WebView view = (WebView) this.findViewById(R.id.webview1);
Toast t9 = Toast.makeText(getApplicationContext(),
"loading:" + url, Toast.LENGTH_SHORT);
t9.show();
view.getSettings().setJavaScriptEnabled(true);
view.loadUrl(url);
Toast t8 = Toast.makeText(getApplicationContext(),
"loaded:" + url, Toast.LENGTH_SHORT);
t8.show();
}
Try this: