![]() |
VOOZH | about |
We all have once used the MS-Paint in our childhood, and when the system was shifted from desks to our palms, we started doodling on Instagram Stories, Hike, WhatsApp, and many more such apps. But have you ever thought about how these functionalities were brought to life? So, In this article, we will be discussing the basic approach used by such apps and will create a basic replica of such apps. A sample video is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using both Java and Kotlin language.
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Select Java/Kotlin as the programming language.
Add the following permissions in AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
We will wil be adding two libraries, one for the draw canvas and the other for the color palette. Refer to DrawingCanvas and ColorPicker to check out their github repositories.
dependencies {
implementation("com.github.Miihir79:DrawingCanvas:1.1.2")
implementation ("com.github.Dhaval2404:ColorPicker:2.3")
}
Adding Jitpack support in settings.gradle.kts
dependencyResolutionManagement {
..
repositories {
..
maven { url = uri("https://jitpack.io/") }
}
}
Add the following drawable files in res > drawable folder.
Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file.
activity_main.xml:
Go to the MainActivity file and refer to the following code. Below is the code for the MainActivity file. Comments are added inside the code to understand the code in more detail.
Refer to this github repository to get the entire code.
There are plenty of things you can add to this project like:-
"Anyone can put paint on a canvas, but only a true master can bring the painting to life.", we finish building our app, now draw some awesome paintings on this canvas and become a "true master".