Codes to improve firebase chatting app in sketchware

Here are a few codes which can be used in the chat application created using Firebase in Sketchware.

1. Remove divider​ height of ListView
To remove the divider height of ListView displaying messages, put following code in onCreate, in an add source directly block.

2. Display end of ListView on refresh
To make the ListView scroll to display the last element of list when updated, put following code in onCreate, in an add source directly block.

3. Set width of ListView items to 3/4 of screen width
Firstly, in CustomView, insert a LinearH linear1, and inside that insert a LinearV linear2. Put all contents to be displayed in linear2.

Now, in event onBindCustomView, add a number variable width. Set width to getDisplayWidthPixels * 0.75, and set it as width of linear2 using following code.
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)width, LinearLayout.LayoutParams.WRAP_CONTENT);

4. Rounded corners and Custom background color
In onBindCustomView event, add a add source directly block and put code to create a GradientDrawable with custom background color and rounded corners, as given below, and set it as background of linear2. gd = new;

5. Display messages of device user on right and those of others on left.
To display messages of user on right and those of others on left, in onBindCustomView event, use blocks as shown in image above. The code used is:
If File user getData key username equals (get value at position key name of List Map map1) then,

6. Hide Keyboard on button click
Add following code in on button click event.
android.view.inputmethod.InputMethodManager imm = (android.view.inputmethod.InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);

To understand more watch the video below.


  1. How to load image from url in listview

  2. Great job. Is it possible make push notifications?

  3. Nice blog........ thanks for this...... App In Minute provides you the platform that you seek for creating your online store. With App In Minute’s help, you can develop your Android Application & Website for free and display your products or services to the world. App in minute can create a free business portfolio app or a gallery app with App In Minute Tool. For more information visit on

    1. Fuck you and your spam mate. Take that shit somewhere else. Don't spam on a person's hard work, dickwad.

  4. This comment has been removed by the author.

  5. Hi Sanjeev,
    How can we get the current location of the device (GPS)?

  6. A questão da ListView quando atualiza a lista ela rola automaticamente para baixo, tem como fazer ela atualizar mais manter a tela na mesma posição? Desde já agradeço

  7. Is it necessary to upload the app to play store? Isn't it possible that two people download it from sketchware only?

    1. You can send the apk file to your friend, no need to upload to play store

  8. How to add chat rooms in chatting App?

  9. How to make notification of this chat app?

  10. This comment has been removed by the author.

  11. Guys what will be happening if my app doesn't open if I send it to another user with android 8.0 mobile phone and the app doesn't open . .it says app not installed

    1. Tell your friend to free up some space and try again

  12. Visit my blog perfect Login With Email Verification

  13. Can you make a chat app where you chat with friends? If you have their numbers like WhatsApp.

  14. is it possible to send sms directly through created app because it opens regular messaging app and i have to type and send the sms


Post a Comment

Popular posts from this blog

Create Music Player app in Sketchware

A Flash Light App in Sketchware

Firebase auth in Sketchware for Login Activity

Simple car racing android game in Sketchware

In Sketchware: How to create a calculator for any simple formula?