简体   繁体   English

SherlockFragment中的未定义getIntent()方法

[英]Undefined getIntent() method in SherlockFragment

Having a issue with the following error 遇到以下错误的问题

The method getIntent() is undefined for the type

While using the following extends SherlockFragment { 使用以下内容时, extends SherlockFragment {

Code

public View onCreateView(LayoutInflater inf, ViewGroup grp, Bundle icicle) {

    View v = inf.inflate(R.layout.activity_main, grp, false);
    web = (WebView) v.findViewById(R.id.webView);
    progressBar = (ProgressBar) v.findViewById(R.id.progressBar1);
    Bundle extras = getIntent().getExtras();
    String url;
    url = extras.getString("url");
    setHasOptionsMenu(true);
    return v;

尝试使用getActivity()===> getActivity()。getIntent()。getExtras();

   Bundle extras = getActivity().getIntent().getExtras();

Try in your OnActivityCreated 尝试您的OnActivityCreated

Bundle bundle = UrFragment.this.getArguments(); 捆绑包= UrFragment.this.getArguments();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM