Logith Kumar B
7 min readSep 2, 2020

Learn like you never know ,Perform like you’re already done…

- Logith Kumar B

I’m Logith from IT department currently pursuing 3rd year in KCG college of technology. I m here to share some of interesting techniques to create the basic Messaging(SMS) app and some button designing techniques.

As many of us think why it is necessary to go for designing android app rather we can go for websites but the fact is that apps are very much smarter and quicker than websites and it was widely used by the people in any case like both offline and online.Some may feel difficult to create apps rather than websites,but the thing is Building android apps are quite interesting and easy like web designing

There are different platforms for designing and building apps among them the I personally suggest Android Studio(Developed by Google) has many built-in features which helps us to built our android project in a better way.

For more details and to download AS use this link->Android Studio.

Create Messaging(SMS) App using Android Studio

Android Studio

INTRODUCTION

I will guide you how to create an SMS app using Android studio which supports Kotlin and Java which are most commonly used.As many of you were eager to create and built apps of your own.So here is my small idea of creating a SMS app.

Before going to the code lets have a clear idea about what are all the components should be present in our project.

The first thing while opening our app we should have a simple layout which shows a text called message in the top and followed by the header called mobile number and a input field which allows the user to enter the mobile number to which the message has to be sent.And also a big input field where the user is going to write the text message.

Like the layout shown below:

For creating those stuffs you should have some requirements which supports in your project.

REQUIREMENTS:

ANDROID STUDIO Latest version(recommended)- to utilize all the latest features of the AS.

→A bit of Programming Knowledge about the basic XML(Extensible Markup Language) and Java.

Android mobile or Android Emulator — inorder to get a better output.

Generally there are two main sections while creating a Android App that is front-end and the back-end.

front-end:

In this you will write full and full design related code for determining the app look.

Back-end:

In this you will write functional related code that is the activity or process that needs to be done when a action or request is performed by the user.

Front-End Design:

Steps to be followed :

Here i posted some steps to be followed to make a front-end layout design.

Step 1: Start the new Android project and wait until the project was built successful.

Step 2: Click on the layouts and open activity_main.xml file and click on the split option on the top to see the code as well as the design part.

Step 3: Use the tag <TextView> to add text and modify text in the layout.

<TextView >-consists of:

The ID and layoutwidth and layout height are used commonly in all tags.

→android:id -to have a unique name.

→android:layout_width and android:layout_height -used to set the height and width of the text.

→android:fontfamily -to have a style for a font.

→android:text -the text that you are going to add.

→android:textAlignment -to align the text.

→android:textcolor -to change the color of the text.

→android:textsize -to change the size of the text.

Source code for Message:

Source code for Mobile Number:

Step 4: Use the <EditText>-allows user to enter the inputs like phone number and the text message to be send.

<EditText>-consists of:

→android:background -used to add the background color for the input field.

→android:hint -used to show temporary text in the input field.

→android:inputType -used to set the type of the data.

→android:textColorHint -used to change the color of the temporary text.

Source code for input field(number):

Source code for input field (text message):

Step 5: Use <Button> tag to add a send button for the message. ..

<Button> tag consists of:

→android:text -to add text in the button

→android:textcolor -to change the color of the text in button

→android:OnClick -used to set the method in back-end which determines what should be done when the button was clicked.

→android:background: ’@drawable/bg-btn’ (explained in button designing)

You should add layout-width,layout-height,id which is common for all those tags <TextView>, <EditView>,<Button> ..etc

Button designing:

There are many designs provided by drawable file.The most common design is button design. To do such things go to resources->drawable, right click on it the choose new resource file and set a name for the file then click ok.

Step 6: Change the <selector> to <shape> where you can design buttons. There are different parameters for designing the button.

1.stroke -to have a beautiful outline for the button.

→android:width -to specify the width of the outline or border.

→android:color -to specify the color of the outline or border.

2.solid-to change the color of the button.

→android:color -to change the color type of the button.

3.corner -to make changes over the corners (like curved or like oval) .

→android:radius -to change the corners of the button.

4.gradient-to change the color over X, Y positions.like

→android:startcolor ,android:centercolor,android:endcolor -defines the color inside at different positions.

→android:angle -to determine the angle to be covered by the X,Y positions.

Source Code for Button design(@ drawable bg_btn):

Steps to be followed for the Back-end function code:

Step 1: Import all the packages that are needed for functioning in back-end.

Step 2: Initialize Phone ,message for Edit Text and Send for button and set the permission request code as 1.

Step 3: Set content view to current activity_main file and Assign phone,Message and Send by method findViewById(R.id. — ).

Step 4: Using check permission method determine if the request was accepted else get the permission from the user by the pop up message whether to allow for sending messages.

Step 5: Using OnSend() method get the input and convert them as String to perform tasks.

Step 6: Using if condition check whether the input is valid or not and then using SMS manager create obj and send the text message which was given in input field to the mobile number mentioned by the user.

Toast is to print the text in app when the particular function is over.

here it shows text if message was successfully send,else it shows not sent.

Step 7: Create function called checkpermission which was called in both Step 4 and Step 6.

create a variable int and store the value of checkselfpermission() which is built-inmethod which checks whether permission granted or not

then compare and values of check with PackageManager which returns

true-when permission was granted.

false-when user permission denied.

Step 8: now,the app have certain permissions needed from the user which is given in project->manifestfolder ->AndroidManifest.xml.

<uses-permission>tag used for allowing permissions for the user.

like INTERNET,WIFI AND SEND_SMS.

Step 9: Finally, go to the menu bar and click the “Make Project” option or press ctrl+f9 to debug the error.

Step 10: Before clicking the “Run” button or press shift+f10 to run the project. And, choose the device to run your app from the target device drop-down menu.

OUTPUT: