title: Error displaying video in VideoView in android
body: <p>I am getting a null pointer exception when trying to set a video to a VideoView in android dialog fragment. Here is my logcat content</p>
  
  <pre><code> Caused by: java.lang.NullPointerException
          at com.shimba.android.ngoma.fragments.VideoUploadFragment.onCreateDialog(VideoUploadFragment.java:52)
          at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:307)
          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121)
          at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
          at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484)
          at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:571)
          at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133)
          at android.app.Activity.performStart(Activity.java:4475)
          at android.app.Activity.performRestart(Activity.java:4526)
          at android.app.Activity.performResume(Activity.java:4531)
          at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2450)
          at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2488)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1174)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:137)
          at android.app.ActivityThread.main(ActivityThread.java:4440)
         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:787)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
                  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>And my code:</p>
  
  <pre><code>    public class VideoUploadFragment extends DialogFragment implements AdapterView.OnItemSelectedListener, View.OnClickListener {
      Spinner genres;
      VideoView videoView;
      TextView submit;
      String filePath;
  
  
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
          AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
          // Get the layout inflater
          LayoutInflater inflater = getActivity().getLayoutInflater();
          View v = inflater.inflate(R.layout.fragment_videoupload_dialog, null);
          builder.setView(v);
  
          genres = (Spinner) v.findViewById(R.id.videoupload_spinner_genre);
  submit=(TextView)v.findViewById(R.id.videoupload_textView_submit);
  
          ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String&gt;(getActivity(),
                  R.layout.ngoma_spinner, getResources().getStringArray(R.array.genres));
          dataAdapter
                  .setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
          genres.setAdapter(dataAdapter);
  
  
          Bundle bundle = getArguments();
          if(bundle != null)
          {
              filePath= bundle.getString("filePath");
          }
          Log.i("videopath", filePath);
          videoView.setVideoPath(filePath);
  
          genres.setOnItemSelectedListener(this);
          submit.setOnClickListener(this);
          return builder.create();
      }
  
      @Override
      public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
      }
  
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; parent) {
  
      }
  
      @Override
      public void onClick(View v) {
          switch(v.getId()){
              case R.id.videoupload_textView_submit:
                  getDialog().dismiss();
                  break;
          }
      }
  }
  </code></pre>
  
  <p>The error is on the line</p>
  
  <pre><code>videoView.setVideoPath(filePath);
  </code></pre>
  
  <p>However, I can see the value of </p>
  
  <pre><code>Log.i("videopath", filePath);
  </code></pre>
  
  <p>Which is </p>
  
  <pre><code>10-31 18:23:16.382  13883-13883/ngoma.android.shimba.com.ngoma I/videopath﹕ /mnt/sdcard/Pictures/Ngoma/VID_20141031_182304.mp4
  </code></pre>
  
  <p>Where am i loosing track?</p>