Posts

Showing posts from June, 2018

JSON syntax

Image
JSON syntax rules Data is in name/value pairs "My name"   :   "Sanjeev" Data is separated by commas { "name" : "Sanjeev" , "age" : "29" , "registration number" : "1628634" } Curly braces hold objects { "name" : "Sanjeev", "age" : "29", "registration number" : "1628634" } Square brackets hold arrays [ { "name" : "Sanjeev", "age" : "29" }, { "name" : "Ranju", "age" : "25" }, { "name" : "Anand", "age" : "16" }, { "name" : "Richa", "age" : "20" } ] A name/value pair consists of   a field   name or key   (in double quotes), followed by a   colon , followed by a   value . {   "name"   :   "Sanjeev"   } Types of Values in JSON In JSON,   values   must be one...

Loading images in WebView in Sketchware

Image
We can use WebView for loading images from any url or for loading images from drawable folder, assets folder, or resource folder of our app. 1. To load an image from a website in WebView, we can directly write the url of the image in the WebView loadUrl block. Even animated gifs can be loaded directly to WebView. WebView   webview1   loadUrl   http://.....jpg 2. We can modify the width and height of this image loaded in WebView by using following code in  WebView loadUrl  block: WebView   webview1   loadUrl   data:text/html,<img width=100% height="" src="(imageUrl)"> We can make it fit the width of the screen by setting width=100% in above code. 3. We can also load the images added using Image Manager in Sketchware (images in drawable folder) with following code: WebView   webview1   loadUrl   file:///android_res/drawable/image Note that in above code image is name of the image and has to be changed acc...