Skip to main content

Posts

Find and Highlight text in ListView

Follow the steps given below to find and highlight text, entered in EditText, in a custom  ListView  in Sketchware. This method makes the use of class  Spannable . 1. In VIEW area of your sketchware project, add  an EditText and a ListView  (edittext1 and listview1). 2. Add a new  CustomView  custom.xml. In this CustomView add two  TextViews  (textview1 and textview2). 3. Now in  properties of ListView , select the new CustomView added as it's  customView . 4. In LOGIC area of your app, add a new  List Map: maplist1.,  and a new  Map: map1.  Also add a Number variable  index  and three String variables  Name ,  Number  and  term . 5. In  onCreate  event in your project, Create a new Map,  add items to the Map  using keys  Name  and  Number (change or increase keys per your need),  and add the Map to the List Map: maplist1. In this way add as many items as desired. In the end use Block  setListCustomViewData  to display the List Map in ListView. (See image below). 6. Add a new event
Recent posts

Admob rewarded video Ads in Sketchware

To integrate Admob Rewarded Video Ads to a Sketchware project, follow the steps given below. Prerequisites An Android project (Sketchware project) Account in Admob Always place the test ad unit ID before placing your ad unit ID. App ID and ad unit ID can be obtained by registering the app on Admob. But for using test ads no registration is required. Do not click on your own Ads. 1. Create an android project in Sketchware. 2. Add the app to your Admob account. For your app, generate an ad unit ID for Rewarded Video Ads. 3. In Sketchware project, navigate to  Library Manager  and open Admob settings. i. Click on Add manually and add the ad unit ID generated on Admob website, or use test ad unit ID ca-app-pub-3940256099942544/5224354917. ii. If you are not using any banner or interstitial ad units, select the same ad unit ID for both banner and interstitial ads. iii. Add Test Device automatically shown by Sketchware. iv. Save it. v. Switch ON Admob and AppCompat and design. 4. In this exa

Create Music Player app in Sketchware

To create a Music Player app in sketchware, follow the steps given below. 1. Create a new project in Sketchware. 2. In VIEW area on main.xml, add a ListView  listview1  with height wrap_content, and weight 1. Add a SeekBar  seekbar1 , an ImageView  imageview1 , and three TextViews  textview1 ,  textview2 , and  textview3 , as shown in the image below. 3. Create a CustomView  mycustom.xml  and add a TextView  textview1 , and an ImageView  imageview1  in it. For listview1 select mycustom.xml as it's customView. 4. Add a MediaPlayer component  mp , a Shared Preferences component  sp:sp  and a Timer component  timer . 5. Create six More Blocks  MPcreate(pos), MPstart , and  MPpause  for the MediaPlayer and  searchFolders ,  getFileList in [filePath]  and  extra . 6. Add three number variables  n, r  and  songPosition , and five String variables  currentfile ,  songMinutes ,  songSeconds ,  folder ,  folderName . Also add a List String  folderList,  List String  fileList  and a List Map

Speech Recognition: Speech to text in Sketchware

We can implement Speech recognition using codes in add source directly block in Sketchware. Follow the steps below to implement Speech recognition in Sketchware. 1. Create a new android project in Sketchware. 2. In VIEW area add a Button  button1  and an EditText  edittext1  (or a TextView). 3. Add a new  FilePicker  component  fp . 4. Add a new More Block  extra . 5. To define this block  extra , use an  add source directly  block and put following code in it: } public static final int REQ_CODE_SPEECH_INPUT = 1; { 6. In the event  button1 onClick , use an add source directly block and put following code: Intent intent = new Intent(android.speech.RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL, android.speech.RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); intent.putExtra(android.speech.RecognizerIntent.EXTRA_PROMPT, "Speak Now"); t

Flash Light App in Sketchware

To create a Torch Flashlight application for Android with Sketchware follow the steps given below. 1. Create a new project in Sketchware. In VIEW area add an ImageView  imageview1 . Set it's width and height to 100, and scale type to FIT_XY. 2. Using Image Manager add two images ic_flash_on_black and ic_flash_off_black. 3. Set ic_flash_off_black as the image of imageview1. 4. In Library manager switch on  AppCompat and Design . 5. Add a  Camera component . 6. Add two Boolean variables:  flashLightStatus  and  hasCameraFlash . 7. Add two More Blocks:  flashLightOn  and  flashLightOff . 8. In  onCreate  event, use add source directly block and put following code: hasCameraFlash = getPackageManager(). hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); 9. In More Block  flashLightOn , use add source directly block and put following code: android.hardware.camera2.CameraManager cameraManager = (android.hardware.camera2.CameraManager) getSystemService(Context.CAMERA_SERVICE); try { St