Guest User

Untitled

a guest
Jan 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. new Handler(Looper.myLooper()).post(new Runnable(){
  2. @Override
  3. public void run(){
  4. videoview.setVideoUri("uri");
  5. }
  6. });
  7.  
  8. public void setVolume(int volume) {
  9. try {
  10. audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0);
  11. ivVoice.setTag(volume != 0);
  12. updateVoiceImage();
  13. } catch (Exception e) {
  14. e.printStackTrace();
  15. }
  16.  
  17. }
  18.  
  19. public void setVolume(int volume) {
  20. try {
  21. //if volume not changed , do nothing.
  22. if(volume != lastVolume){
  23. audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,volume,0);
  24. ivVoice.setTag(volume != 0);
  25. updateVoiceImage();
  26. lastVolume = volume;
  27. }
  28. } catch (Exception e) {
  29. e.printStackTrace();
  30. }
  31.  
  32. }
  33.  
  34. VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview);
  35. myVideoView.setVideoURI(Uri.parse(url));
  36. myVideoView.setMediaController(new MediaController(this));
  37. myVideoView.requestFocus();
  38. myVideoView.start();
Add Comment
Please, Sign In to add comment