SherlockFragment中未定义的getIntent()方法

Jai*_*oks 0 java android android-intent android-fragments actionbarsherlock

遇到以下错误的问题

The method getIntent() is undefined for the type

使用以下内容时 extends SherlockFragment {

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;
Run Code Online (Sandbox Code Playgroud)

Laz*_*nja 5

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

   Bundle extras = getActivity().getIntent().getExtras();
Run Code Online (Sandbox Code Playgroud)