VOOZH about

URL: https://www.geeksforgeeks.org/android/implementing-edit-profile-data-functionality-in-social-media-android-app/

⇱ Implementing Edit Profile Data Functionality in Social Media Android App - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Implementing Edit Profile Data Functionality in Social Media Android App

Last Updated : 23 May, 2024

This is the Part 3 of "Build a Social Media App on Android Studio" tutorial, and we are going to cover the following functionalities in this article:

  • We are going to edit our profile data like changing name, changing the password of the user, and changing profile pic.
  • Changing password is a very important feature because it may happen that sometimes someone knows our password and in that case, we need to change our password.
  • We change our profile pic using selecting an image from the gallery or clicking an image from the camera.

Step By Step Implementation

Step 1: Add dependency to build.gradle (Module: app)

Navigate to the Gradle Scripts > build. gradle(Module: app) and add the below dependency in the dependencies section.

implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

Now sync the project from the top right corner option of Sync now.

Step 2: Add read, write and camera permission in the AndroidManifest.xml file

Navigate to the AndroidManifest.xml file and add the below permission for getting read, write and camera permission in the app.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

Step 3: Create a new empty activity and name the activity as EditProfilePage

Working with the activity_edit_profile_page.xml  file. On this page will be changing the email, name, and profile picture of the user. Navigate to the app > res > layout > activity_edit_profile_page.xml and add the below code to that file. Below is the code for the activity_edit_profile_page.xml file. 

Step 4: Create a new layout resource file

Go to the app > res > layout > New > Layout Resource File and name the file as dialog_update_password. Navigate to the app > res > layout > dialog_update_password.xml and add the below code to that file. Below is the code for the dialog_update_password.xml file. 

Step 5: Working with the EditProfilePage.java file

Go to the EditProfilePage.java file and refer to the following code. Below is the code for the EditProfilePage.java file. Comments are added inside the code to understand the code in more detail.

Step 6: Create Realtime Database inside the firebase console

Go to the firebase console > Realtime Database and create your database.

👁 Image

Then Start in Test Mode and Enable the real-time database.

👁 Image

Output:

When you update the data, the data is stored like the following

👁 Image

Note: Please Add drawable items before running the Application

Below is the file structure after performing these operations:

👁 Image

Comment
Article Tags:
Article Tags:

Explore