Shubham Ankit

Shubham Ankit


How to make your Kotlin Android animations accessible

When researching examples for a first ever Android contribution, few examples existed for animations written in Kotlin. There were also few code examples of accessibility considerations within native animations.

So here we go! Let’s look at writing a native ‘expand’ animation in Kotlin, and talk about how to assist those with TalkBack or enlarged text turned on. All code is available in this example repo, creating a single activity with an animated view within it. The code this is based on was co-written with Calum Turner.

Android accessibility (a11y)

All Android devices come with a built in screen reader named TalkBack. This can be turned on from the device’s settings, and also has a first time use guide built in. Gestures are used to navigate around the page, with descriptions of focused elements read aloud. Without this, an app becomes unusable for many visually impaired users.

Of key importance is that the correct elements are focusable, have descriptions, and changes to the view are announced.

Within the same settings menu the default base font size can be adjusted, scaling from 1.0. Views should react to this change in font size, with all elements still present and functioning.


We won’t look at the styling specifics of the layout here as they are fairly unique to this example, but the accessibility touches are worth highlighting.

Two properties are used: android:contentDescription and android:importantForAccessibility.

The contentDescription is what is read when an element gains focus. For any ImageView that gains focus this is essential, otherwise a screen reader will instead read the useless ‘unlabelled’ to the user.

If this was a button it would read ‘ button, double tap to activate’ by default, but for our ImageView icon we manually specify the action as we do not have this default.

android:contentDescription="tap to toggle extra person information"

We also use importantForAccessibility:no to turn OFF focus for the ‘+’ TextView, as the text beneath the two badges provides a description and so the ‘+’ is more confusing than helpful if read aloud.

For both of these, manual testing on a real device with TalkBack turned on is the best indication of whether the context makes sense without visuals.

Expand Animation

Our animation will activate on an ‘info’ icon tap, toggling the expanding of a details section.

We will do this all inside a single activity to allow focus simply on the animation code. In a real world app, the view this is applied to is more likely to be within its own fragment or recycler view, so a more abstracted code structure would be used.

Setting a listener

Within our example activity’s onCreate we must first set a listener on our icon and pass in the view that is to be toggled.

infoIcon.setOnClickListener **{** toggleCardBody(root.personEntryBody) **}**

We also set up a variable within the class to track if the view is toggled, setting it to initially be closed.

private var isToggled = false

Toggle expand animation

Within our layout, we have set the height of personEntryBody to 0dp.

To toggle this open we need to know the new height to set it to, how long the animation should be, and what height it should be at each moment of the animation.

We then need to set isToggled to its inverse, and ensure that when tapped again it does the reverse.

**private fun** toggleCardBody(body: View) {
    body.measure(ViewGroup.LayoutParams._MATCH_PARENT_, ViewGroup.LayoutParams._WRAP_CONTENT_)
    **val** maxHeight = body._measuredHeight_ + body._paddingTop_ + body._paddingBottom_ **val** startHeight = **if** (**isToggled**) maxHeight **else** 0
    **val** targetHeight = **if** (**isToggled**) 0 **else** maxHeight
**val** expandAnimator = ValueAnimator
    .ofInt(startHeight, targetHeight)

expandAnimator.addUpdateListener **{
    val** value = **it**._animatedValue_ **as** Int
    body._layoutParams_.**height** = value
**}** expandAnimator._doOnEnd_ **{
 **   isToggled = !isToggled **}** expandAnimator.start()


As the height when the view is initially drawn is 0, we must calculate its new size by remeasuring its layout.

As described in the Android view layout docs, we can use measure() along with the layout params we assigned to the view to remeasure each time the info icon is tapped.

To calculate the max height we must manually add the top and bottom padding to this, as these are not included in the measured height.

Depending on isToggled we then know if we are starting from 0 or starting from the expanded max height, and so the opposing target height.

We use a Value Animator to move from the starting value to the target end value, and set the duration in ms. This duration is based purely on later manual testing for UX feel.

.ofInt(startHeight, targetHeight)

We tie the duration to the height with an update listener, requesting a new layout to be drawn after each update and adjusting the height each time.

    expandAnimator.addUpdateListener {
value = it.animatedValue as Int
body.layoutParams.height = value
} expandAnimator.doOnEnd **{
** isToggled = !isToggled } expandAnimator.start()

As we are using Kotlin, we also add the [androidx]( to our build.gradle to benefit from its doOnEnd extension. This allows us to very easily inverse the isToggled variable.

Finally we start our animation! Already we have a body that expands and contracts on an icon touch!

Smoother animations

While our animation technically works as is, a nice extra step is to add an interpolator so that the movement feels more natural.

expandAnimator.interpolator = FastOutSlowInInterpolator()

Increasing our accessibility

We’ll add two final things to hopefully help our a11y users.

First we can help with navigation using an [AccessibilityEvent]( .

expandAnimator.doOnEnd { if (!isToggled)       body.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
isToggled = !isToggled }

This means that when the animation moves from closed to open, the focus will immediately jump to the focus on the first item in the body, in this case the description. In the layout, we set the description of the info icon action, but as we may not be able to rely on a visual indicator for the user to move to the next item we can handle this for them.

Second we allow for different font sizes. The measured height returned from measure() does not account for font scaling set in the devices accessibility settings, and so when at a large scale the bottom of the description will be cropped as it is too large to fit.

We can access the font scale programmatically, and scale our height based on this. We convert it to an integer as the font scale may result in a float which would not work as a layout height.

val a11yFontScale = body.context.resources.configuration.fontScale
maxHeight = ((body.measuredHeight + body.paddingTop + body.paddingBottom) * a11yFontScale).toInt()


And there we have it, we have arrived at our final animation! With just a few extra lines we have greatly increased its a11y coverage and have a smooth expanding section revealing a Kotlin and Android badge 😉

Thanks for reading 😁

Originally published by Dominic Fraser at

Learn more

☞ The Complete Android Kotlin Developer Course

☞ Kotlin for Android: Beginner to Advanced

☞ Kotlin for Beginners: Learn Programming With Kotlin

☞ Android Kotlin Development Masterclass using Android Oreo

☞ Kotlin for Android & Java Developers: Clean Code on Android

☞ Kotlin Android Development Masterclass - With Android Oreo

#kotlin #android #mobile-apps

What is GEEK

Buddha Community

How to make your Kotlin Android animations accessible
Autumn  Blick

Autumn Blick


Top Android Projects with Source Code

Android Projects with Source Code – Your entry pass into the world of Android

Hello Everyone, welcome to this article, which is going to be really important to all those who’re in dilemma for their projects and the project submissions. This article is also going to help you if you’re an enthusiast looking forward to explore and enhance your Android skills. The reason is that we’re here to provide you the best ideas of Android Project with source code that you can choose as per your choice.

These project ideas are simple suggestions to help you deal with the difficulty of choosing the correct projects. In this article, we’ll see the project ideas from beginners level and later we’ll move on to intermediate to advance.

top android projects with source code

Android Projects with Source Code

Before working on real-time projects, it is recommended to create a sample hello world project in android studio and get a flavor of project creation as well as execution: Create your first android project

Android Projects for beginners

1. Calculator

build a simple calculator app in android studio source code

Android Project: A calculator will be an easy application if you have just learned Android and coding for Java. This Application will simply take the input values and the operation to be performed from the users. After taking the input it’ll return the results to them on the screen. This is a really easy application and doesn’t need use of any particular package.

To make a calculator you’d need Android IDE, Kotlin/Java for coding, and for layout of your application, you’d need XML or JSON. For this, coding would be the same as that in any language, but in the form of an application. Not to forget creating a calculator initially will increase your logical thinking.

Once the user installs the calculator, they’re ready to use it even without the internet. They’ll enter the values, and the application will show them the value after performing the given operations on the entered operands.

Source Code: Simple Calculator Project

2. A Reminder App

Android Project: This is a good project for beginners. A Reminder App can help you set reminders for different events that you have throughout the day. It’ll help you stay updated with all your tasks for the day. It can be useful for all those who are not so good at organizing their plans and forget easily. This would be a simple application just whose task would be just to remind you of something at a particular time.

To make a Reminder App you need to code in Kotlin/Java and design the layout using XML or JSON. For the functionality of the app, you’d need to make use of AlarmManager Class and Notifications in Android.

In this, the user would be able to set reminders and time in the application. Users can schedule reminders that would remind them to drink water again and again throughout the day. Or to remind them of their medications.

3. Quiz Application

Android Project: Another beginner’s level project Idea can be a Quiz Application in android. Here you can provide the users with Quiz on various general knowledge topics. These practices will ensure that you’re able to set the layouts properly and slowly increase your pace of learning the Android application development. In this you’ll learn to use various Layout components at the same time understanding them better.

To make a quiz application you’ll need to code in Java and set layouts using xml or java whichever you prefer. You can also use JSON for the layouts whichever preferable.

In the app, questions would be asked and answers would be shown as multiple choices. The user selects the answer and gets shown on the screen if the answers are correct. In the end the final marks would be shown to the users.

4. Simple Tic-Tac-Toe

android project tic tac toe game app

Android Project: Tic-Tac-Toe is a nice game, I guess most of you all are well aware of it. This will be a game for two players. In this android game, users would be putting X and O in the given 9 parts of a box one by one. The first player to arrange X or O in an adjacent line of three wins.

To build this game, you’d need Java and XML for Android Studio. And simply apply the logic on that. This game will have a set of three matches. So, it’ll also have a scoreboard. This scoreboard will show the final result at the end of one complete set.

Upon entering the game they’ll enter their names. And that’s when the game begins. They’ll touch one of the empty boxes present there and get their turn one by one. At the end of the game, there would be a winner declared.

Source Code: Tic Tac Toe Game Project

5. Stopwatch

Android Project: A stopwatch is another simple android project idea that will work the same as a normal handheld timepiece that measures the time elapsed between its activation and deactivation. This application will have three buttons that are: start, stop, and hold.

This application would need to use Java and XML. For this application, we need to set the timer properly as it is initially set to milliseconds, and that should be converted to minutes and then hours properly. The users can use this application and all they’d need to do is, start the stopwatch and then stop it when they are done. They can also pause the timer and continue it again when they like.

6. To Do App

Android Project: This is another very simple project idea for you as a beginner. This application as the name suggests will be a To-Do list holding app. It’ll store the users schedules and their upcoming meetings or events. In this application, users will be enabled to write their important notes as well. To make it safe, provide a login page before the user can access it.

So, this app will have a login page, sign-up page, logout system, and the area to write their tasks, events, or important notes. You can build it in android studio using Java and XML at ease. Using XML you can build the user interface as user-friendly as you can. And to store the users’ data, you can use SQLite enabling the users to even delete the data permanently.

Now for users, they will sign up and get access to the write section. Here the users can note down the things and store them permanently. Users can also alter the data or delete them. Finally, they can logout and also, login again and again whenever they like.

7. Roman to decimal converter

Android Project: This app is aimed at the conversion of Roman numbers to their significant decimal number. It’ll help to check the meaning of the roman numbers. Moreover, it will be easy to develop and will help you get your hands on coding and Android.

You need to use Android Studio, Java for coding and XML for interface. The application will take input from the users and convert them to decimal. Once it converts the Roman no. into decimal, it will show the results on the screen.

The users are supposed to just enter the Roman Number and they’ll get the decimal values on the screen. This can be a good android project for final year students.

8. Virtual Dice Roller

Android Project: Well, coming to this part that is Virtual Dice or a random no. generator. It is another simple but interesting app for computer science students. The only task that it would need to do would be to generate a number randomly. This can help people who’re often confused between two or more things.

Using a simple random number generator you can actually create something as good as this. All you’d need to do is get you hands-on OnClick listeners. And a good layout would be cherry on the cake.

The user’s task would be to set the range of the numbers and then click on the roll button. And the app will show them a randomly generated number. Isn’t it interesting ? Try soon!

9. A Scientific Calculator App

Android Project: This application is very important for you as a beginner as it will let you use your logical thinking and improve your programming skills. This is a scientific calculator that will help the users to do various calculations at ease.

To make this application you’d need to use Android Studio. Here you’d need to use arithmetic logics for the calculations. The user would need to give input to the application that will be in terms of numbers. After that, the user will give the operator as an input. Then the Application will calculate and generate the result on the user screen.

10. SMS App

Android Project: An SMS app is another easy but effective idea. It will let you send the SMS to various no. just in the same way as you use the default messaging application in your phone. This project will help you with better understanding of SMSManager in Android.

For this application, you would need to implement Java class SMSManager in Android. For the Layout you can use XML or JSON. Implementing SMSManager into the app is an easy task, so you would love this.

The user would be provided with the facility to text to whichever number they wish also, they’d be able to choose the numbers from the contact list. Another thing would be the Textbox, where they’ll enter their message. Once the message is entered they can happily click on the send button.

#android tutorials #android application final year project #android mini projects #android project for beginners #android project ideas #android project ideas for beginners #android projects #android projects for students #android projects with source code #android topics list #intermediate android projects #real-time android projects

How to Develop an Android App with Kotlin?

Do you have an idea to develop an android app using Kotlin?

Are you looking for the best Kotlin app development company in the USA? We at AppClues Infotech offering versatile mobile app development services in the USA. We provide custom mobile app development solutions as per your specific business needs with the prevailing market trending technology & features.

Hire our top-notch Kotlin app designers & developers for your project at a cost-effective price.

Our Kotlin App Development Services:
• Custom Android App Development
• Kotlin AR/VR App Development
• Kotlin App UI/UX Design
• Kotlin App QA & Testing- code Optimization
• Kotlin App Migrations
• Kotlin App Maintenance and Upgrades

For more info:
Call: +1-978-309-9910

#kotlin android app development company #best kotlin android app development usa #kotlin android app development #kotlin for android app development #kotlin mobile app development service #create android app with kotlin

Top Kotlin Android App Development Company in USA

Looking for a top Kotlin Android app development company for creating an Android app project? AppClues Infotech is a top Kotlin Android app development company in USA that delivers the most scalable and efficient Kotlin app development services globally.

For more info:
Call: +1-978-309-9910

#kotlin android app development company #best kotlin android app development usa #kotlin android app development #kotlin for android app development #kotlin mobile app development service #create android app with kotlin

Top-notch Kotlin App Development Company in USA

Are you looking for the best Kotlin Android App Development Company in USA? We at AppClues Infotech help to create a successful kotlin Android App with creative technology & features at competitive price.

For more info:
Call: +1-978-309-9910

#kotlin android app development company #best kotlin android app development usa #kotlin android app development #kotlin for android app development #kotlin mobile app development service #create android app with kotlin

Chaz  Homenick

Chaz Homenick


Building Dark Mode Theme in Android

Hello World, today we are going to see how we can implement a dark theme or night mode in our android application. This tutorial is going to be very simple and easy to understand. The dark theme is attractive to users and it is comfortable for low light conditions.

Recently many apps adapt dark mode in their app and the output of the night mode is amazing as many users love dark mode for their app. An example of a dark theme is Whatsapp dark mode in android see the below image.

Let’s look at how our app will look like, see the below gif for our end result app.

Let’s see how we can implement dark theme in our app.

Make layout for dark theme

First, we need to make our layout so that we can apply our dark theme to it.

If you see the above gif we used cardview to make our layout.

See the below code for layout.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=""



                android:text="John Doe"
                android:text="Just now"

                android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry."





        android:text="Change Theme"



#android-app-development #android-development #android-studio #android #android-tutorial #android-dark-mode #android-mobile-app #mobile