Read Json file from asset in Sketchware Pro



Hello guys 👋
In this article I will explain how to read file from json and parse it in custom listview

First of all you need sketchware Pro
If you don't have you find it in my app

After that you can follow the tutorial :

Add listview


Create customview 

Link your listview with custom view you make


Then add your file in asset folder 

Then in logic arrea click onCreate
Add two variables json and data

Add listmap map

Then add this code




try {
  java.io.InputStream is = this.getAssets().open("data.json");
           int size = is.available();
           byte[] buffer = new byte[size];
           is.read(buffer);
           is.close();
           json = new String(buffer, "UTF-8");
 //here add your listview data bind

} catch(Exception e) {
 
}

Then in onBindCustomView 

This is almost everything you need 
If you didn't understand then watch video tutorial




Comments

Post a Comment

Popular posts from this blog

Change wallpaper Programmatically Sketchware

Web Scraping With Jsoup in Sketchware