title: two layouts using video view in fragment orientation change
body: <p>I am developing a application has two different layout in portrait and landscape.</p>
  
  <p>Each layout contain two fragments. One fragment contains a video view which plays a video from the internet. When orientation is changed, the video restarts.</p>
  
  <p>I want to play the video without restarting.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>**This is my main activity.**
  ------------------------    
  
  
  public class MainActivity extends Activity {
              VIdeoFragment vfr = null;
              ImageFragment ifr = null;
  
              @Override
              public void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.main_activity);
              vfr = new VIdeoFragment();
              ifr = new ImageFragment();
             FragmentTransaction ft1 = getFragmentManager().beginTransaction();
             FragmentTransaction ft2 = getFragmentManager().beginTransaction();
             ft1.add(R.id.upper_view, vfr, "Vfr");
             ft2.add(R.id.down_view, ifr, "IFR");
  
              ft1.commit();
              ft2.commit();
              }
              }
  
      **--------------------------------
      VIdeoFragment** 
  
  
  
  public class VIdeoFragment extends Fragment {
              VideoView vv,oldVV;
              View view=null;
   public static String movieUri =  "http://www.prep-zone.com/androidVideo/College Admission from Prep Zone (HD).mp4";
              @Override
              public void onActivityCreated(Bundle savedInstanceState) {
                  super.onActivityCreated(savedInstanceState);
                  Uri video = Uri.parse(movieUri); 
                  vv.setVideoURI(video);
                  vv.start();
                      }
                  @Override
                  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                          Bundle savedInstanceState) {
              view = inflater.inflate(R.layout.video, container, false);
  
                      vv = (VideoView) view.findViewById(R.id.videoView1);
                      return view; 
                  }
              }
      ---------------------------------------------
      ImageFragment 
  
  
  
  public class ImageFragment extends Fragment {
  
                  @Override
                  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                          Bundle savedInstanceState) {
                      return  inflater.inflate(R.layout.image, container,false);  
                  }
  }
      -------------------------------------------
  
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
              &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="vertical" &gt;
  
                  &lt;ImageView
                      android:id="@+id/imageView1"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:src="@drawable/ic_action_search" /&gt;
  
              &lt;/LinearLayout&gt;
  
      ------------------------------
  
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
              &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="vertical" &gt;
  
                  &lt;VideoView
                      android:id="@+id/videoView1"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:orientation="vertical" /&gt;
  
              &lt;/LinearLayout&gt;
                  -------------------------------------
                  portrait main xml
                  ----------------
  
  
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:tools="http://schemas.android.com/tools"
                  android:id="@+id/LinearLayout1"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="vertical" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/upper_view"
                      android:layout_width="match_parent"
                      android:layout_height="0dp"
                      android:layout_weight="1" &gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/down_view"
                      android:layout_width="match_parent"
                      android:layout_height="0dp"
                      android:layout_weight="1" &gt;
                  &lt;/LinearLayout&gt;
  
              &lt;/LinearLayout&gt;
  
                  ------------------------------------
                  landscape xml
                  ----------------
  
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:tools="http://schemas.android.com/tools"
                  android:id="@+id/LinearLayout1"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="horizontal" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/upper_view"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight="1"&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/down_view"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight="1"&gt;
                  &lt;/LinearLayout&gt;
  
              &lt;/LinearLayout&gt;
  --------------------------------------------------------
  
  
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
          &lt;application
              android:icon="@drawable/ic_launcher"
              android:label="@string/app_name"
              android:theme="@style/AppTheme" &gt;
              &lt;activity
                  android:name=".MainActivity"
                  android:label="@string/title_activity_main" &gt;
                  &lt;intent-filter&gt;
                      &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                      &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
                  &lt;/intent-filter&gt;
              &lt;/activity&gt;
          &lt;/application&gt;
  
          ================================================
          please help.Thank you.
  </code></pre>