This is the Part 4 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 retrieve data of users From Firebase.
- This is a simple fragment in which we will retrieve data of users like name, email, and profile pic from real-time Database and showing that in text layout and image layout.
- In the future, we are also going to show the blogs of users on the profile page.
Step By Step Implementation
Step 1: Working with the fragment_profile.xml file
On this page will be the retrieving email, name, and profile picture of the user. And also we have added the Material Floating Action Button to update the data. Navigate to the app > res > layout > fragment_profile.xml and add the below code to that file. Below is the code for the fragment_profile.xml file.
Step 2: Working with the ProfileFragment.java file
Go to the ProfileFragment.java file and refer to the following code. Below is the code for the ProfileFragment.java file. Comments are added inside the code to understand the code in more detail.
For all the drawable file used in this article please refer to this link: https://drive.google.com/drive/folders/1M_knOH_ugCuwSP5nkYzeD4dRp-Honzbe?usp=sharing
Below is the file structure after performing these operations:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.