Showing posts from September, 2018

Enable Fullscreen for Youtube videos in WebView

To enable fullscreen mode for YouTube videos in your sketchware project, follow the steps given below. 1. Create a new project in Sketchware. 2. In VIEW area add a WebView  webview1. 3. Create a more block  extra . 4. In the more block  extra , use an add source directly blocks and put codes to define a new WebChromeClient class with name CustomWebClient . } public class CustomWebClient extends WebChromeClient { private View mCustomView; private WebChromeClient.CustomViewCallback mCustomViewCallback; protected FrameLayout frame; // Initially mOriginalOrientation is set to Landscape private int mOriginalOrientation =; private int mOriginalSystemUiVisibility; // Constructor for CustomWebClient public CustomWebClient() {} public Bitmap getDefaultVideoPoster() { if (MainActivity.this == null) { return null; } return BitmapFactory.decodeResource(MainActivity.this.getApplicationContext().getResources

VideoView in Sketchware

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. Define the MediaController, anchor it to the Video

SearchView for String list in Sketchware

To implement a SearchView for a simple ListView showing a String list in Sketchware, follow the steps given below. 1. Create a new project in Sketchware. 2. In VIEW area add a ListView listview1 . 3. Switch On AppCompat and Design. 4. Create a String List list . 5. Create a more block extra . 6. In the more block extra , use an add source directly block and put codes to declare a SearchView searchview and an ArrayAdapter adapter . After that add the SearchView as an OptionsMenu item. } searchview; ArrayAdapter<String> adapter; @Override public boolean onCreateOptionsMenu( Menu menu) { menu.add(0,0,0,"search").setActionView(searchview).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } { 7. In onCreate event, add items to the String List list . 8. After adding items to the list use add source directly blocks and put following codes: i. Define the ArrayAdapter and set it as adapter of L

Create PopupWindow in Sketchware

The CustomView can be used to create a custom PopupWindow in Sketchware, by using simple codes. Follow the steps below to create a custom PopupWindow. 1. In VIEW area of your project add a new CustomView ' myview.xml '. 2.  Design the CustomView  the way you want your custom PopupWindow to look like. In the image above, I have added four TextViews, of which two act as buttons (namely ' textview3 ' and ' textview4 '). 3. Choose the event on which you want to show the PopupWindow. It can be onBackPressed or onButtonClick, etc. 4. On the event when dialog is to be shown, use  add source directly  blocks to create and show the PopupWindow. In the image above I have added the code to button1 onClick event. The code used is explained below. a) First create a View from the CustomView layout file (myview.xml) which will be used as PopupWindow. View popupView = getLayoutInflater().inflate(R.layout. myview , null); Note that here 'myview&#

Create a PDF reader android App in Sketchware

To create a simple pdf reader in Sketchware follow the instructions given below. 1. Create a new project in Sketchware and create a VIEW as shown in image below: linear2 : A LinearH for the buttons/tools. linear3 : A LinearV for displaying images. Set it's padding to 0. button1 : A Button for picking PDF files. edittext1 : An EditText for displaying the page number. Set it's input type to numberSigned . textview4 : A TextView for displaying total number of pages. textview3 : A Button to move to page number entered in edittext1. textview1 : A Button to move to previous page. textview2 : A Button to move to next page. 2. Remove Toolbar and Status Bar of this View to make it full screen. 3. Add a File Picker component file_picker: application/pdf . 4. Add two number variables page and pageCount , and a String variable pdfFile . Also add a String list. 5. Add two more blocks: extra and display page(i) . 6. In onCreate event use add s