Retrieve contact list in Sketchware
To read contact list in Sketchware pro, follow the steps given below.
1. In the Sketchware project, in main.xml, add a ListView. Also add a custom view for ListView items. For the ListView, select the custom view.
2. Switch on AppCompat and design.
3. In permission manager, select android.permission.READ_CONTACTS.
4. In Activity, add Import event. Put following codes in the import event:
5. Create a more block getAllContacts of type List Map. In this more block, put following codes:
In above code, the name and number of contacts is retrieved and added to a map variable using keys "name" and "number". This map variable is added to a Map list, which is returned as the result.
6. Create another more block readContacts of type regular (Void). In this more block, put following blocks which retrieve contacts and display in ListView:
Comments
Post a Comment