-1

I am newbie in android development.i am making one app to show a differnt type of video.i have one navigation drawer that contain different types of option named as favourite video.when I click my favourite video navigation drawer I am getting unexpected error while trying to show my favourite video. Below is the logcat message recieved:

12-20 05:13:06.062: E/AndroidRuntime(1039): FATAL EXCEPTION: main
12-20 05:13:06.062: E/AndroidRuntime(1039): java.lang.RuntimeException: Unable to start activity        ComponentInfo{com.dsnl.omygod/com.ebizzinfotech.MenuFragments.CustomPlayer}:    java.lang.NullPointerException: uriString
12-20 05:13:06.062: E/AndroidRuntime(1039):     at  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.os.Looper.loop(Looper.java:137)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at  android.app.ActivityThread.main(ActivityThread.java:4745)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at java.lang.reflect.Method.invokeNative(Native Method)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at java.lang.reflect.Method.invoke(Method.java:511)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at dalvik.system.NativeStart.main(Native Method)
12-20 05:13:06.062: E/AndroidRuntime(1039): Caused by: java.lang.NullPointerException: uriString
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.net.Uri$StringUri.<init>(Uri.java:464)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.net.Uri$StringUri.<init>(Uri.java:454)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.net.Uri.parse(Uri.java:426)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at  com.ebizzinfotech.MenuFragments.CustomPlayer.onCreate(CustomPlayer.java:58)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.app.Activity.performCreate(Activity.java:5008)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
12-20 05:13:06.062: E/AndroidRuntime(1039):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
12-20 05:13:06.062: E/AndroidRuntime(1039):     ... 11 more

below is the activity code.

@Override
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    setContentView(R.layout.player);

    Bundle b = getIntent().getExtras();
    VIDEO_ID = b.getString("VIDEO_URL");
    //Log.i("video id print",VIDEO_ID);
    loading = (ProgressBar) findViewById(R.id.loading);

    stop = (Button) findViewById(R.id.stop);
    playtogglebutton = (ToggleButton) findViewById(R.id.playtogglebutton);
    timeElapsed = (TextView) findViewById(R.id.timeElapsed);
    timeEnd = (TextView) findViewById(R.id.timeEnd);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);

    videoviewer = (VideoView) findViewById(R.id.videoviewer);


    videoviewer.setVideoURI(Uri.parse(VIDEO_ID));

    videoviewer.requestFocus();
    videoviewer.setKeepScreenOn(true);
    videoviewer.setOnErrorListener(this);
    videoviewer.setOnPreparedListener(this);

}
Divyang Patel
  • 347
  • 3
  • 14

3 Answers3

1

hmm are you activate the internet permission in manifest file?

if don't use

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

more information

Post

Community
  • 1
  • 1
1

Null pointer exception.

Caused by: java.lang.NullPointerException: uriString

Check the value of uriString

0

Check the value of Uri.parse(VIDEO_ID). You may get some hints.