Posts

Showing posts from May, 2018

How to load limited items from Firebase into ListView

Image
If your Firebase database contains lots of items and you wish to load only limited items from it, so that it loads faster, then you can make use of Firebase Query . To load limited items from Firebase database, follow the steps given below. 1. Add a ListView listview1  and a TextView textview1 in VIEW area. 2. Create a CustomView custom.xml.  This should contain as many TextViews as data to be displayed at each position (let them be textview1 , textview2 , textview3 ). 3. Select custom .xml as the CustomView of listview1 . 4. Add a FirebaseDB component specific to the firebase path you have in your database. I have added FirebaseDB component Chat: chat   where chat is the path in firebase database, and Chat is a DatabaseReference to created in the app to the Firebase path chat. 5. Add a new number variable limit . 6. Add a String list str and a Map list map1 . 7. In onCreate event: a. Set the number variable limit to 6 (or to the number of items you w

Add ListView to Navigation drawer

Image
In the latest version of Sketchware (v2.2.2), appcompat-v7 and design have been added, and we can now add a navigation drawer to our project. This navigation drawer uses a CustomView. But the CustomView in Sketchware doesn't have option to add a ListView. In order to add a ListView to the drawer, we have to create the ListView programmatically and then add it to the drawer. To know how it can be done follow the steps given below. 1. In your Sketchware android project, go to Library manager and switch on AppCompat and Design. 2. In View manager , go to MainActivity.java and select Navigation Drawer Activity . 3. Now go to the CustomView drawer_main and add a LinearV linear1 . Set it's width as MATCH_PARENT. 4. Create a new String list mylist . 5. Create a new Intent component i . 6. Now suppose you have five other activities SettingsActivity.java , NotesActivity.java , FeedbackActivity.java , PrivacyActivity.java , and AboutActivity.java . Add a w