Call error

0

I'm using Fragment and making adaptations, as in getIntent() ... Inserting it getActivity() as it was explained by a user, other times it was informed was useful and worked, but this time a error just in the line where I try to make the call.

logcat error:

01-19 20:33:22.690      875-875/player.kmk.com.kmk E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NullPointerException
            at player.kmk.com.kmk.menu3_Fragment.onCreateView(menu3_Fragment.java:29)
            at android.app.Fragment.performCreateView(Fragment.java:1699)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:885)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057)
            at android.app.BackStackRecord.run(BackStackRecord.java:682)
            at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435)
            at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441)
            at android.os.Handler.handleCallback(Handler.java:725)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
            at dalvik.system.NativeStart.main(Native Method)

menu3_fragment.java

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ScrollView;
import android.widget.TextView;
import player.kmk.com.kmk.parser.RSSFeed;

public class menu3_Fragment extends Fragment {
    View rootview;
    WebView desc;
    RSSFeed feed;
    TextView title;
    public menu3_Fragment(){}

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        rootview = inflater.inflate(R.layout.menu3_layout, container, false);
        ScrollView sv = (ScrollView) rootview.findViewById(R.id.sv);
        sv.setVerticalFadingEdgeEnabled(true);
        feed = (RSSFeed) getActivity().getIntent().getExtras().get("feed");
        int pos = getActivity().getIntent().getExtras().getInt("pos");
        title = (TextView) rootview.findViewById(R.id.title);
        desc = (WebView) rootview.findViewById(R.id.desc);
        WebSettings ws = desc.getSettings();
        ws.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        ws.getPluginState();
        ws.setPluginState(WebSettings.PluginState.ON);
        ws.setJavaScriptEnabled(true);
        ws.setBuiltInZoomControls(true);

        // Set the views
        title.setText(feed.getItem(pos).getTitle());
        desc.loadDataWithBaseURL("http://www.androidcentral.com/", feed
                .getItem(pos).getDescription(), "text/html", "UTF-8", null);

        return rootview;
    }
}
    
asked by anonymous 19.01.2016 / 22:21

0 answers