Code example for Fragment

Methods: onSaveInstanceState, setUserVisibleHint

0
     * http://stackoverflow.com/questions/8748064/starting-activity-from 
     * -fragment-causes-nullpointerexception 
     */ 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        setUserVisibleHint(true);
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 
        // load html from html file from /res/raw 
        InputStream inputStreamText = this.getActivity().getResources().openRawResource(R.raw.help);
 
        mActivity = getActivity();
 
        LinearLayout layout = new LinearLayout(mActivity);
 
        JellyBeanSpanFixTextView text = new JellyBeanSpanFixTextView(mActivity);