VOOZH about

URL: https://www.geeksforgeeks.org/android/how-to-create-a-morse-code-converter-android-app/

⇱ How to Create a Morse Code Converter Android App? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Create a Morse Code Converter Android App?

Last Updated : 15 Jul, 2025

Morse code is a way in which one can encode characters and text using dots and dashes. The international Morse codes contain 26 letters of the alphabet and some non-English letters that are Arabic numerals as well as some punctuation. In Morse code, there is no difference between the upper and lower case letters. The transmission of the Morse Code is measured in dot durations.

The Morse Code Converter App is an app that is used to convert the given statements to Morse Code. This is done by using Android Studio. So in this article lets create a Morse Code Converter Android App using Java/Kotlin language. This project also involves the conversion of the Morse Code into relevant Statements. It means both encoding and decoding can be done using this Android app.

Steps to Implement Morse Code Convertor

Step 1: Create a New Project

To create a new project in Android Studio please refer How to Create/Start a New Project in Android Studio.

Step 2: Working with activity_main.xml file

Create 2 EditTexts in the xml file. One for writing the input and the other one for displaying the output. EditTexts are used because on clicking on the EditTexts the text can be selected and copied which will be very useful in sending the coded/uncoded message some other person using any messaging app. Make 3 Buttons: Encode, Decode and Clear.

The Encode Button will take the input as text from the input EditText and then encode it into morse code and display it in the output EditText. The Decode Button will take the morse code as input from the input EditText and then decode it into alphabets and numbers and display it in the output EditText. The Clear Button will clear the input and output EditTexts.

activity_main.xml:


Design UI:

👁 morse-code-app


Step 4: Working with MainActivity file

In this file we will be fetching all UI elements using findViewById(). Then, create a map that corresponds every letter and number to their morse codes. Now, create a reverse map which maps all the morse codes to their corresponding letters and numbers.

Create three functions for encode, decode and clearing all fields. In the encode and decode function we will mapping the user input letter by letter and display the output to their corresponding morse codes and vice versa.

MainActivity File:

Refer to the following repo to get the entire code:Morse_Code_Convertor_Android

Output:


Comment

Explore