Posts

Showing posts with the label VideoView in Sketchware

VideoView in Sketchware

Image
To add a VideoView to play videos picked from Sdcard follow following steps in Sketchware. 1. Create a new project in Sketchware. 2. In VIEW area add a Button button1 and a LinearLayout  linear2 . 3. Create a String List  list,  and a String variable str . 4. Add a FilePicker component fp with mime type video/* . 5. Create a more block  extra . 6. In the more block  extra , use an add source directly block and put codes to declare a VideoView  vidview  and an MediaController mediaControls . } VideoView vidview; MediaController mediaControls; { 7. In  onCreate  event, use  add source directly  blocks and put following codes: i. Define the VideoView vidview, set it's LayoutParams, and add it to the linear 2. vidview = new VideoView(this); vidview.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); linear2.addView(vidview); ii. ...