How to Make a Meme Sharing App in Android Studio?
Last Updated :
23 Jul, 2025
Pre-requisites:
In this article, we will learn how to create an app using Kotlin where memes will be fetched from Reddit using an API and will be shown on the screen. These memes can also be shared using other apps like(WhatsApp, Facebook, etc) to your friends. We will learn how to do API calls and how to use Volley and Glide libraries in our project. Note that we are going to implement this project using the Kotlin language. A sample video is given below to get an idea about what we are going to do in this article.
Step by Step Implementation
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Kotlin as the programming language.
Step 2: Working with the activity_main.xml file
Navigate to the app > res > layout > activity_main.xml and make the following layout or add the below code to that file. Below is the code for the activity_main.xml file.
Design for Meme Share App
XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!--Layout where image will be loaded-->
<ImageView
android:id="@+id/memeImageView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/shareButton"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/avatars"/>
<!--Progress bar which gets disabled whenever meme is loaded-->
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/memeImageView"
app:layout_constraintLeft_toLeftOf="@id/memeImageView"
app:layout_constraintRight_toRightOf="@id/memeImageView"
app:layout_constraintTop_toTopOf="@id/memeImageView" />
<!--Next Button which loads another meme-->
<Button
android:id="@+id/nextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:onClick="nextmeme"
android:text="NEXT"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toRightOf="@id/guideline"
android:padding="32dp"
tools:ignore="OnClick" />
<!--Share button which allows you to share memes-->
<Button
android:id="@+id/shareButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="SHARE"
android:onClick="sharememe"
android:padding="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/guideline"
tools:ignore="OnClick" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Step 3: Add dependency and Modify the AndroidManifest.xml
Search for an API that has lots of memes, for eg we will be using this API. To load the memes from the API, we will be using the Volley library from which we will get a URL from the JSON object, to convert that URL to an actual image we will be using the Glide library. Navigate to the Gradle Scripts> build.gradle(Module : appname.app) and add the following dependencies
Kotlin
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
Navigate to the app > manifests > AndroidManifest.xml and add internet permission to your app's manifest, without this, we won't be able to connect to the internet.
<uses-permission android:name="android.permission.INTERNET" />
Step 4: Working with the MainActivity.kt file
Now, open MainActivity.kt file here, you need to create three functions:-
loadmeme()
It loads a meme from API using Volley and shows it on the app screen.
Kotlin
private fun loadmeme() {
// Initializing a progress bar which
// gets disabled whenever image is loaded.
val progressBar: ProgressBar =findViewById(R.id.progressBar)
progressBar.visibility= View.VISIBLE
val meme: ImageView =findViewById(R.id.memeImageView)
// Instantiate the RequestQueue.
val queue = Volley.newRequestQueue(this)
val url = "https://meme-api.herokuapp.com/gimme"
// Request a JSON object response from the provided URL.
val jsonObjectRequest = JsonObjectRequest(
Request.Method.GET, url, null,
{ response ->
// Storing the url of meme from the API.
presentImageUrl = response.getString("url")
// Displaying it with the use of Glide.
Glide.with(this).load(presentImageUrl).listener(object: RequestListener<Drawable> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
progressBar.visibility= View.GONE
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: com.bumptech.glide.request.target.Target<Drawable>?,
dataSource: com.bumptech.glide.load.DataSource?,
isFirstResource: Boolean
): Boolean {
progressBar.visibility= View.GONE
return false
}
}).into(meme)
}
) {
Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG).show()
}
// Add the request to the RequestQueue.
queue.add(jsonObjectRequest)
}
nextmeme()
It will load another meme whenever we click on the NEXT button on the app screen.
Kotlin
fun nextmeme(view: View) {
// Calling loadmeme() whenever
// Next button is clicked.
loadmeme()
}
sharememe()
It allows us to share the meme URL to other platforms like WhatsApp, Fb, etc by clicking on the button SHARE on the app screen.
Kotlin
fun sharememe(view: View) {
// Creating an Intent to share
// the meme with other apps.
val intent= Intent(Intent.ACTION_SEND)
intent.type="text/plain"
intent.putExtra(Intent.EXTRA_TEXT, "Hey, Checkout this cool meme $presentImageUrl")
val chooser = Intent.createChooser(intent, "Share this meme")
startActivity(chooser)
}
Complete Code of MainActivity.kt File
Kotlin
package com.example.gfgmeme
import android.content.Intent
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.android.volley.Request
import com.android.volley.toolbox.JsonObjectRequest
import com.android.volley.toolbox.Volley
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target
class MainActivity : AppCompatActivity() {
var presentImageUrl: String?=null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Calling loadmeme() to display the meme.
loadmeme()
}
private fun loadmeme() {
// Initializing a progress bar which
// gets disabled whenever image is loaded.
val progressBar: ProgressBar =findViewById(R.id.progressBar)
progressBar.visibility= View.VISIBLE
val meme: ImageView =findViewById(R.id.memeImageView)
// Instantiate the RequestQueue.
val queue = Volley.newRequestQueue(this)
val url = "https://meme-api.herokuapp.com/gimme"
// Request a JSON object response from the provided URL.
val jsonObjectRequest = JsonObjectRequest(
Request.Method.GET, url, null,
{ response ->
// Storing the url of meme from the API.
presentImageUrl = response.getString("url")
// Displaying it with the use of Glide.
Glide.with(this).load(presentImageUrl).listener(object: RequestListener<Drawable> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
progressBar.visibility= View.GONE
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: com.bumptech.glide.request.target.Target<Drawable>?,
dataSource: com.bumptech.glide.load.DataSource?,
isFirstResource: Boolean
): Boolean {
progressBar.visibility= View.GONE
return false
}
}).into(meme)
}
) {
Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG).show()
}
// Add the request to the RequestQueue.
queue.add(jsonObjectRequest)
}
fun nextmeme(view: View) {
// Calling loadmeme() whenever
// Next button is clicked.
loadmeme()
}
fun sharememe(view: View) {
// Creating an Intent to share
// the meme with other apps.
val intent= Intent(Intent.ACTION_SEND)
intent.type="text/plain"
intent.putExtra(Intent.EXTRA_TEXT, "Hey, Checkout this cool meme $presentImageUrl")
val chooser = Intent.createChooser(intent, "Share this meme")
startActivity(chooser)
}
}
Output:
Similar Reads
How to Create/Start a New Project in Android Studio? After successfully installing the Android Studio and opening it for the first time. We need to start with some new projects to start our journey in Android.In this article, we will learn about How to Create a New Project in Android Studio.Steps to Create/Start a New Android Project in Android Studio
2 min read
How to Get Image from Image Asset in Android Studio? While Developing an App, we require many images as an icon in our app. Here we are going to explain how we can get image in Android Studio using Image Asset. Creating an attractive launcher icon for your app, that the user will first come across while looking at your app, anyway needs more brainstor
1 min read
How to Build a Sticky Notes Application in Android Studio? We as humans tend to forget some small but important things, and to resolve this we try to write those things up and paste them somewhere, we often have eyes on. And in this digital era, the things we are most likely to see are laptop, computer, or mobile phone screens. For this, we all have once us
11 min read
How to Make a Joke App in Android Using API Call? Jokes are the best way to keep the face smiling. With the power of technology, we can create apps that provide instant access to a broad Category(i.e. animal, money, career, dev etc ) of jokes at any time. In this article, we will create a Joke App in Android that uses API calls to fetch jokes from
7 min read
A Complete Guide to Learn Android Studio For App Development Before diving into the vast field of Android Development, there is a need to understand the tools required for it. The name of the tool is Android Studio, used for developing Android Applications. Android Studio is developed by Google and JetBrains. It's the most widely used software for developing
10 min read
How to Make an Motivational Quotes App in Android using API Call? In this article, we will see the process of building a Motivational Quotes App for Android that fetches random quotes from an API and displays them to the user. By the end of this article, we will have a Complete Android application that connects to an API, retrieves motivational quotes and author n
5 min read