Task 14
Task 14
Coding:
Profile.xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".InfoActivity"
android:background="#FDCDE5">
<androidx.cardview.widget.CardView
android:layout_width="157dp"
android:layout_height="155dp"
android:layout_gravity="center"
android:layout_marginTop="50sp"
android:background="#FEFEFE"
app:cardCornerRadius="100000dp">
<ImageView
android:id="@+id/ivInfoLogo"
android:layout_width="310dp"
android:layout_height="193dp"
android:layout_gravity="center"
android:contentDescription="@string/title"
android:src="@drawable/info" />
</androidx.cardview.widget.CardView>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnInfoInfo"
android:layout_width="223dp"
android:layout_marginTop="20sp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/etbgshape4"
android:text="Change Profile Photo"
android:textColor="#1B5B7E"
android:textSize="16sp"
android:textStyle="bold"/>
<androidx.cardview.widget.CardView
android:id="@+id/cvInfo"
android:layout_width="369dp"
android:layout_height="335dp"
android:layout_marginLeft="20sp"
android:layout_marginTop="50sp"
android:layout_marginRight="20sp"
app:cardBackgroundColor="#1B5B7E"
android:layout_gravity="center"
app:cardCornerRadius="20sp"
app:cardElevation="20sp">
<LinearLayout
android:layout_width="369dp"
android:layout_height="335dp"
android:layout_gravity="end"
android:background="#1B5B7E"
android:orientation="vertical">
<TextView
android:id="@+id/tvInfoName"
android:layout_width="350dp"
android:layout_height="44dp"
android:layout_margin="10sp"
android:background="@drawable/etbgshape2"
android:drawablePadding="9sp"
android:fontFamily="@font/alegreya"
android:paddingStart="23sp"
android:text="Name"
android:textColor="#1B5B7E"
android:textSize="24sp"
android:textStyle="bold"
app:drawableLeftCompat="@drawable/name" />
<TextView
android:id="@+id/tvInfoMobileNo"
android:layout_width="350dp"
android:layout_height="44dp"
android:layout_margin="10sp"
android:background="@drawable/etbgshape2"
android:drawablePadding="9sp"
android:fontFamily="@font/alegreya"
android:paddingStart="23sp"
android:text="Mobile No."
android:textColor="#1B5B7E"
android:textSize="24sp"
android:textStyle="bold"
app:drawableLeftCompat="@drawable/mobileno" />
<TextView
android:id="@+id/tvInfoEmailID"
android:layout_width="350dp"
android:layout_height="44dp"
android:layout_margin="10sp"
android:background="@drawable/etbgshape2"
android:drawablePadding="9sp"
android:fontFamily="@font/alegreya"
android:paddingStart="23sp"
android:text="Email ID"
android:textColor="#1B5B7E"
android:textSize="24sp"
android:textStyle="bold"
app:drawableLeftCompat="@drawable/emailid" />
<TextView
android:id="@+id/tvInfoUsername"
android:layout_width="350dp"
android:layout_height="44dp"
android:layout_margin="10sp"
android:background="@drawable/etbgshape2"
android:drawablePadding="9sp"
android:fontFamily="@font/alegreya"
android:paddingStart="23sp"
android:text="Username"
android:textColor="#1B5B7E"
android:textSize="24sp"
android:textStyle="bold"
app:drawableLeftCompat="@drawable/name" />
<TextView
android:id="@+id/tvInfoPassword"
android:layout_width="350dp"
android:layout_height="44dp"
android:layout_margin="10sp"
android:background="@drawable/etbgshape2"
android:drawablePadding="9sp"
android:fontFamily="@font/alegreya"
android:paddingStart="23sp"
android:text="Password"
android:textColor="#1B5B7E"
android:textSize="24sp"
android:textStyle="bold"
app:drawableLeftCompat="@drawable/password" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</ScrollView>
Coding:
Profile.java:
package com.example.sscreative;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_info);
preferences = PreferenceManager.getDefaultSharedPreferences(InfoActivity.this);
editor = preferences.edit();
ivProfilePhoto = findViewById(R.id.ivInfoLogo);
btnProfile = findViewById(R.id.btnInfoInfo);
tvName=findViewById(R.id.tvInfoName);
tvMobileNo=findViewById(R.id.tvInfoMobileNo);
tvEmailId=findViewById(R.id.tvInfoEmailID);
tvUsername=findViewById(R.id.tvInfoUsername);
tvPassword=findViewById(R.id.tvInfoPassword);