Introduction
Android is one of the most popular operating systems for mobile. Sharing is an important thing in our lives especially technology and knowledge sharing. If you create a photo editing app, it will share the photos on social media apps after editing. Functionality is the most important thing in Android development. So, I will show you how to add the "Share" option in Android applications using Android Studio. Android is a kernel-based operating system that allows users to modify the GUI components and source code.
Prerequisites
- Android Studio
- Little bit XML and JAVA knowledge.
- Android Emulator (or) Android mobile
- Download link (Android Studio)
The Process
Carefully follow my steps to create the "Share" option in your Android application using Android Studio. I have included the source code too.
Step 1
Open the Android Studio and start a new project.

Step 2
Put the application name and company domain. If you wish to use C++ for coding the project, mark the "Include C++ support" and then click Next.
Step 3
Select the Android Minimum SDK. After you chose the minimum SDK, it will show the approximate percentage of people using that SDK. Just click Next.

Step 4
Choose the basic activity then click Next.

Step 5
Put activity name and layout name. Android Studio basically takes Java class name to what you provide the activity name. Click Finish.

Step 6
First, you need to design the application. So, go to activity_main.xml and click the text button. This XML file contains the designing code for the Android app. Into the activity_main.xml, copy and paste the below code.
Activity_main.xml code
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:orientation="vertical"
- tools:context="ganeshannt.sharing.MainActivity">
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="Enter the text that you want to share!"
- android:textSize="20sp"
- android:id="@+id/editText"/>
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="80dp"
- android:text="Share"
- android:onClick="Clicked"
- android:layout_gravity="center_horizontal"/>
- </LinearLayout>
The above code is used to create the edit text row and button.











Joe WilsonPosted May 4, 2017, 5:13 AM
Thank you for sharing it.