java - Error on Backpressed Video Gallery -


i have module selects video gallery put videoview. when try click gallery pressed, crashes application , point me code. (the code line arrow)

here's code.

@override public void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);  --->    uri filepath = data.getdata();      path = filepath+"";     if (requestcode == record_video && resultcode == activity.result_ok && data.getdata() != null) {         ivvideo.setvideopath(path);         ivvideo.setmediacontroller(new android.widget.mediacontroller(getactivity()));         ivvideo.requestfocus();         ivvideo.start();         uri selectedimageuri = data.getdata();         selectedpath = getpath(selectedimageuri);      }  } 

here's onclicklistener.

ivgallery.setonclicklistener(new view.onclicklistener() {     @override     public void onclick(view v) {          intent intent = new intent();         intent.settype("video/*");         intent.setaction(intent.action_get_content);         startactivityforresult(intent.createchooser(intent, "select video"),record_video);      } }); 

check if data null inside onactivityresult()

   @override public void onactivityresult(int requestcode, int resultcode, intent data) {   if(data!=null){     // code   } } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -