Sunday, October 31, 2021

School Application Complete | School Complete Project in Android Studio ...

Login registration in Firebase shared Preference

Insert Image and retrive image in recycle view

 Insert Data :- 

Xml Page:----------------


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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=".Classwork">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/classsubject"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Subject"
android:textSize="20sp"/>
<EditText
android:id="@+id/classdate"
android:textStyle="bold"
android:layout_marginRight="20dp"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Date"
android:textSize="20sp"/>

</RelativeLayout>
<View
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#787676"/>
<EditText
android:id="@+id/classwrite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Email Writting"
android:gravity="center"
android:textSize="20sp"
android:textStyle="bold"/>
<EditText
android:id="@+id/note"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Dear student kindly go through the attach file"
android:textSize="15sp"/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="150dp"
android:id="@+id/classimage"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Classname"
android:id="@+id/enterclass"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Upload"
android:id="@+id/upload"/>
</LinearLayout>
</LinearLayout>

Java Page:-----------------

package com.niranjan.schooladmin;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;

import java.sql.Ref;

public class Classwork extends AppCompatActivity {
TextView subject,date,heading,note,classname;
ImageButton imageView;
Button upload;
FirebaseDatabase mdatabase;
DatabaseReference mref;
FirebaseStorage mstorage;
private static final int Gallery_Code=1;
Uri imageurl = null;
ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_classwork);


mdatabase=FirebaseDatabase.getInstance();
mref=mdatabase.getReference().child("Classwork");
mstorage = FirebaseStorage.getInstance();


classname=findViewById(R.id.enterclass);
subject=findViewById(R.id.classsubject);
date=findViewById(R.id.classdate);
heading=findViewById(R.id.classwrite);
note=findViewById(R.id.note);
imageView=findViewById(R.id.classimage);
upload=findViewById(R.id.upload);
progressDialog=new ProgressDialog(this);


imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent,Gallery_Code);
}
});

}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode==Gallery_Code && resultCode==RESULT_OK)
{
imageurl=data.getData();
imageView.setImageURI(imageurl);
}
upload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String su=subject.getText().toString().trim();
String da=date.getText().toString().trim();
String he=heading.getText().toString().trim();
String no=note.getText().toString().trim();
String cl= classname.getText().toString().trim();
if (!(su.isEmpty() && da.isEmpty() && he.isEmpty() && no.isEmpty() && imageurl!=null))
{
progressDialog.setTitle("Uploading....");
progressDialog.show();
StorageReference filepath =mstorage.getReference().child("imagePost").child(imageurl.getLastPathSegment());
filepath.putFile(imageurl).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Task<Uri> downloadurl = taskSnapshot.getStorage().getDownloadUrl().addOnCompleteListener(new OnCompleteListener<Uri>() {
@Override
public void onComplete(@NonNull Task<Uri> task) {
String t = task.getResult().toString();
DatabaseReference newPost = mref.push();
newPost.child("Date").setValue(da);
newPost.child("Subject").setValue(su);
newPost.child("Headind").setValue(he);
newPost.child("Note").setValue(no);
newPost.child("classname").setValue(cl);
newPost.child("image").setValue(task.getResult().toString());
progressDialog.dismiss();



}
});
}
});
}
}
});
}
}





Retrive Process:-


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"
android:padding="10dp"
tools:context=".Classwork">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/classworkrec"/>
</androidx.constraintlayout.widget.ConstraintLayout>


Create Xml Page:----

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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=".Classwork">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/classsubject"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Subject"
android:textSize="20sp"/>
<EditText
android:id="@+id/classdate"
android:textStyle="bold"
android:layout_marginRight="20dp"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Date"
android:textSize="20sp"/>

</RelativeLayout>
<View
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#787676"/>
<EditText
android:id="@+id/classwrite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Email Writting"
android:gravity="center"
android:textSize="20sp"
android:textStyle="bold"/>
<EditText
android:id="@+id/note"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Dear student kindly go through the attach file"
android:textSize="15sp"/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="150dp"
android:id="@+id/classimage"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Classname"
android:id="@+id/enterclass"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Upload"
android:id="@+id/upload"/>
</LinearLayout>
</LinearLayout>


Model Class :---


package com.niranjan.createschoolapp.Model;

public class Classworkmodel {
String Date,Subject,Headind,Note,image,classname;

public Classworkmodel() {
}

public Classworkmodel(String date, String subject, String headind, String note, String image, String classname) {
Date = date;
Subject = subject;
Headind = headind;
Note = note;
this.image = image;
this.classname = classname;
}

public String getDate() {
return Date;
}

public void setDate(String date) {
Date = date;
}

public String getSubject() {
return Subject;
}

public void setSubject(String subject) {
Subject = subject;
}

public String getHeadind() {
return Headind;
}

public void setHeadind(String headind) {
Headind = headind;
}

public String getNote() {
return Note;
}

public void setNote(String note) {
Note = note;
}

public String getImage() {
return image;
}

public void setImage(String image) {
this.image = image;
}

public String getClassname() {
return classname;
}

public void setClassname(String classname) {
this.classname = classname;
}
}




Adapter Class :--

package com.niranjan.createschoolapp.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.niranjan.createschoolapp.Model.Classworkmodel;
import com.niranjan.createschoolapp.R;
import com.squareup.picasso.Picasso;

import java.util.List;

public class Classworkadapter extends RecyclerView.Adapter<Classworkadapter.ViewHolder>{
private Context context;
private List<Classworkmodel> classworkmodelList;

public Classworkadapter(Context context, List<Classworkmodel> classworkmodelList) {
this.context = context;
this.classworkmodelList = classworkmodelList;
}

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new Classworkadapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.classwork,parent,false));

}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
// Glide.with(context).load(classworkmodelList.get(position).getUrl()).into(holder.imageView);
holder.subject.setText(classworkmodelList.get(position).getSubject());
holder.date.setText(classworkmodelList.get(position).getDate());
holder.heading.setText(classworkmodelList.get(position).getHeadind());
holder.note.setText(classworkmodelList.get(position).getNote());
Classworkmodel classworkmodel = classworkmodelList.get(position);
String imageUri = null;
imageUri=classworkmodel.getImage();
Picasso.get().load(imageUri).into(holder.imageView);


}

@Override
public int getItemCount() {
return classworkmodelList.size();
}

public class ViewHolder extends RecyclerView.ViewHolder {
TextView subject,date,heading,note;
ImageView imageView;
public ViewHolder(@NonNull View itemView) {
super(itemView);
subject=itemView.findViewById(R.id.classworksubject);
date=itemView.findViewById(R.id.classdate);
heading=itemView.findViewById(R.id.classwrite);
note=itemView.findViewById(R.id.classnote);
imageView=itemView.findViewById(R.id.classworkimage);
}
}
}







Java File:-


package com.niranjan.createschoolapp;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import com.google.firebase.storage.FirebaseStorage;
import com.niranjan.createschoolapp.Adapter.Classworkadapter;
import com.niranjan.createschoolapp.Adapter.Homeworkadapter;
import com.niranjan.createschoolapp.Model.Classworkmodel;
import com.niranjan.createschoolapp.Model.Usermodel;

import java.util.ArrayList;
import java.util.List;

import static java.lang.String.valueOf;

public class Classwork extends AppCompatActivity {
//FirebaseFirestore firestore;
// FirebaseAuth auth;

FirebaseDatabase mdatabase;
DatabaseReference mref;
FirebaseStorage mstorage;


// FirebaseDatabase firebaseDatabase;
RecyclerView recyclerView;
List<Classworkmodel> classworkmodelList;
Classworkadapter classworkadapter;
// private SharedPreferences getShared;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_classwork);

// getShared = getSharedPreferences("classname",AppCompatActivity.MODE_PRIVATE);
// String className = getShared.getString("classname","");
// Toast.makeText(this, className, Toast.LENGTH_SHORT).show();

//firestore=FirebaseFirestore.getInstance();
//firebaseDatabase=FirebaseDatabase.getInstance();
// auth=FirebaseAuth.getInstance();

mdatabase=FirebaseDatabase.getInstance();
mref=mdatabase.getReference().child("Classwork");
mstorage = FirebaseStorage.getInstance();



recyclerView=findViewById(R.id.classworkrec);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext(),RecyclerView.VERTICAL,false));
classworkmodelList = new ArrayList<>();
classworkadapter= new Classworkadapter(getApplicationContext(),classworkmodelList);
recyclerView.setAdapter(classworkadapter);

mref.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
Classworkmodel classworkmodel =snapshot.getValue(Classworkmodel.class);
classworkmodelList.add(classworkmodel);
classworkadapter.notifyDataSetChanged();
}

@Override
public void onChildChanged(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {

}

@Override
public void onChildRemoved(@NonNull DataSnapshot snapshot) {

}

@Override
public void onChildMoved(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {

}

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});


}
}








Tuesday, October 26, 2021

User enter the Location | Searchbar in Map | Seach location in Android S...



Xml Code:- 


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
<SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#2BFA07" />

</RelativeLayout>



Java Code:- 

package com.niranjan.maps;

import androidx.fragment.app.FragmentActivity;

import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.widget.SearchView;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

import java.io.IOException;
import java.util.List;

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap gMap;
SearchView searchView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
searchView = findViewById(R.id.search);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
String location = searchView.getQuery().toString();
List<Address> addressList = null;
if (location != null || location.equals("")) {
Geocoder geocoder = new Geocoder(MapsActivity.this);
try {
addressList = geocoder.getFromLocationName(location, 1);
} catch (IOException e) {
e.printStackTrace();
}
Address address = addressList.get(0);
LatLng latLng = new LatLng(address.getLatitude(), address.getLongitude());
gMap.addMarker(new MarkerOptions().position(latLng).title(location));
gMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 10));
}
return false;
}

@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
mapFragment.getMapAsync(this);
}

@Override
public void onMapReady(GoogleMap googleMap) {
gMap = googleMap;
}
}

Tuesday, October 19, 2021

Card view Design in Grid layout

 <ScrollView

        android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout

android:gravity="center"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:layout_weight="8"
android:columnOrderPreserved="false"
android:alignmentMode="alignMargins"
android:rowCount="5"
android:columnCount="3">
<androidx.cardview.widget.CardView

android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>

<LinearLayout
android:id="@+id/classwork"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/classwork"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ClassWork"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView

android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/homework"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/homework"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home Work"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/assignment"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/assignment"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Assignment"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/attendance"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/attendance"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Attendance"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/timetable"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/timetable"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time Table"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/holiday"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/holidays"></ImageView>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Holidays"
android:textSize="12sp"
android:textStyle="bold" />


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/noticboard"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/noticeboard"></ImageView>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Notice Board"
android:textSize="12sp"
android:textStyle="bold" />


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/books"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/books"></ImageView>

<TextView
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_gravity="center"
android:text="Books"
android:textSize="12sp"
android:textStyle="bold" />


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/activity"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/activity"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Activity"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/feedues"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/fee"></ImageView>

<TextView
android:layout_width="wrap_content"
android:layout_height="19dp"
android:layout_gravity="center"
android:text="Fee/Dues"
android:textSize="12sp"
android:textStyle="bold" />


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/result"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/result"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Result"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/transport"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/transport"></ImageView>

<TextView
android:layout_width="54dp"
android:layout_height="11dp"
android:layout_gravity="center"
android:text="Transport"
android:textSize="12sp"
android:textStyle="bold" />


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/location"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Navigation"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/onlineclass"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/onlineclass"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Online Class"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_columnWeight="1"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_rowWeight="1"
app:cardElevation="8dp"
app:cardCornerRadius="8dp"
>
<LinearLayout
android:id="@+id/tour"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="120dp"
android:background="@drawable/schooltour"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tour"
android:layout_gravity="center"
android:textSize="12sp"
android:textStyle="bold"/>


</LinearLayout>
</androidx.cardview.widget.CardView>
</GridLayout>

</LinearLayout>
</LinearLayout>
</ScrollView>

Activity Navigation One Activity to another Activity

Main Activity :-   <? xml version ="1.0" encoding ="utf-8" ?> < RelativeLayout xmlns: android ="http://sch...