Code example for Fragment

Methods: getActivity, startActivity

0
    private void loadPostPreview() { 
 
        if (WordPress.getCurrentPost() != null) { 
            if (WordPress.getCurrentPost().getLink() != null 
                    && !WordPress.getCurrentPost().getLink().equals("")) { 
                Intent i = new Intent(getActivity(), PreviewPostActivity.class);
                startActivity(i);
            } 
        } 
    } 
 
    private void goToSeo() { 
        if (WordPress.getCurrentPost() != null) { 
            Intent i = new Intent(getActivity(), SeoResultActivity.class);
            startActivity(i);
        } 
    } 
 
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try {