android - VideoView (Can't create handler inside thread) -


i'm trying make videoview work asynctask. however, there errors couldnt understand. please check on codes? i'm getting error "java.lang.runtimeexception: can't create handler inside thread has not called looper.prepare()"

@override         protected void doinbackground(void... params) {             try {                 getwindow().setformat(pixelformat.translucent);                 mediacontroller mediacontroller = new mediacontroller(                         mainactivity.this);                 mediacontroller.setanchorview(videoview);                  uri video = uri.parse(videopath);                 videoview.setmediacontroller(mediacontroller);                 videoview.setvideouri(video);                 videoview.requestfocus();                 videoview.setonpreparedlistener(new onpreparedlistener() {                      public void onprepared(mediaplayer mp) {                          pdialog.dismiss();                         videoview.start();                     }                 });             } catch (exception e) {                  system.out.println("video play error :" + e.tostring());                 // finish();             }             return null;          } 

you can't update view on doinbackground method. move code updating view on onpostexecute method.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -