这是我的WebActivity代码。我有两个活动->资源活动和webActivity。我正在将URL从Resource Activity传递到WebActivity。请指导我应在哪个Activity中放置该代码,即Resource Activity或Web Activity?
public class WebActivity extends AppCompatActivity {
private WebView mwebview;
private ProgressDialog progressBar;
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
final WebView mwebview = (WebView) findViewById(R.id.webview);
WebSettings webSettings = mwebview.getSettings();
mwebview.setWebViewClient(new WebViewClient());
webSettings.setJavaScriptEnabled(true);
String uri = getIntent().getExtras().getString("uri");
mwebview.loadUrl(uri);
String auri = getIntent().getExtras().getString("auri");
mwebview.loadUrl(auri);
String huri = getIntent().getExtras().getString("huri");
mwebview.loadUrl(huri);
String eouri = getIntent().getExtras().getString("eouri");
mwebview.loadUrl(eouri);
String houri = getIntent().getExtras().getString("houri");
mwebview.loadUrl(houri);
String bouri = getIntent().getExtras().getString("bouri");
mwebview.loadUrl(bouri);
}
//My OnBackPressed Code
@Override
public void onBackPressed()
{
if (mwebview.canGoBack())
mwebview.goBack();
else
super.onBackPressed();
}
}