Android fragments 如何通过putExtra getExtra在一个Web视图中显示来自片段的多个链接

Android fragments 如何通过putExtra getExtra在一个Web视图中显示来自片段的多个链接,android-fragments,android-activity,android-webview,Android Fragments,Android Activity,Android Webview,我想使用putExtra getExtra在一个Web视图中显示一个片段中的多个链接,但我的代码不起作用 facebookBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(getActivity().getApplicationContext()

我想使用putExtra getExtra在一个Web视图中显示一个片段中的多个链接,但我的代码不起作用

    facebookBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent=new Intent(getActivity().getApplicationContext(),WebViewActivity.class);
            intent.putExtra("Link", urls[0]);
            getActivity().startActivity(intent);


        }
    });

在WebViewActivity中,只需在
onCreateMethod()
中使用这两行即可


然后使用此
链接
在您的webview中加载网页。

在您的webview活动中,只需在
onCreateMethod()
中使用这两行即可


之后,使用此
链接
在您的网络视图中加载网页。

我使用了这两行,但仍然不起作用。受保护的void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_webview);mytoolbar=findviewbyd(R.id.mytoolbar);webview=findviewbyd(R.id.webview);pb=findviewbyd(R.id.pb);Intent=getIntent();String website=intent.getStringExtra(“链接”);添加WebViewActivity的代码,只需编辑您的问题并添加WebViewActivity的代码。我使用了这两行代码,但仍然不起作用。受保护的void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_webview);mytoolbar=findviewbyd(R.id.mytoolbar);webView=findviewbyd(R.id.webView);pb=findviewbyd(R.id.pb);Intent Intent=getIntent();String website=Intent.getStringExtra(“链接”);添加WebViewActivity的代码,只需编辑您的问题并添加WebViewActivity的代码即可
Intent intent = getIntent();
String link = intent.getStringExtra("Link");