SplitView doesnt work in portrait mode in android
<p>I have a simple splitview using fragment. Two Fragement java class ar named Left and Right. The Launcher class is given here:</p>

<pre><code>package com.powergroup.splitview;

import com.powergroup.splitview.Left.OnButtonClickListener;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class SplitviewActivity extends FragmentActivity implements
        OnButtonClickListener {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

    }

    @Override
    public void onClickButton(String s) {

        Right rightFr = (Right) getSupportFragmentManager().findFragmentById(
                R.id.view_right);

        rightFr.setText(s);

    }

}
</code></pre>

<p>The code of the Left class is given here:</p>

<pre><code>package com.powergroup.splitview;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class Left extends Fragment {

    public interface OnButtonClickListener {
        public void onClickButton(String s);
    }

    // onCreateView
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.main_button, container, false);

        Button btn1 = (Button) view.findViewById(R.id.btB);
        // button listener
        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                sendTexttoFr("Text From Fragment");

            }
        });

        return view;
    }

    protected void sendTexttoFr(String s) {
        // TODO Auto-generated method stub
        Right rightFr = (Right) getActivity().getSupportFragmentManager()
                .findFragmentById(R.id.view_right);

        rightFr.setText(s);

    }
}
</code></pre>

<p>The code for the Right Class is:</p>

<pre><code>package com.powergroup.splitview;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class Right extends Fragment {

    // onCreateView
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.right_text, container, false);
        return view;
    }

    public void setText(String string) {

        TextView tv = (TextView) getView().findViewById(R.id.tvT);
        tv.setText(string);

    }

}
</code></pre>

<p>When i click on the button in landscape mode the textview from the Right class changes, but In Portrait mode it force closes saying NULLPOINTER EXCEPTION in <code>rightFr.setText(s);</code></p>

<p>I cant figure out the error, can any one helo?</p>
