0% found this document useful (0 votes)
25 views48 pages

Madmicro Report

No

Uploaded by

jenishdevaliya7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views48 pages

Madmicro Report

No

Uploaded by

jenishdevaliya7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 48

Micro-project

Of
Mobile Application Development
4351604
Ttitle:-
“Event management app”
By:-
Devaliya jenish k.(216200316001)
Of
Sem5-it-A
Under Guidance of
Khayati Kalaria Ma’am
Abstact

This Event Rental System allows users to find and book event rental
equipment and services. Users can search for local rental providers, and
compare prices and reviews from other users. The app also offers a
scheduling feature for users to set up rental periods and delivery times.
The app is designed for event planners and organizers who want to rent
equipment and services for their events, such as tents, tables, chairs,
lighting, and sound systems.
Event Planning: Users can create and manage events
by specifying details such as date, time, location, and
the type of event.
Key feature:-
1. Guest Management: The app allows for efficient
guest list management, including sending invitations,
tracking RSVPs, and managing guest preferences.
2. Agenda and Schedule: Users can design event
schedules and agendas, ensuring that attendees are
informed about all activities and sessions.
3. Ticketing and Registration: The app facilitates
ticket sales and event registration, making it easy for
both organizers and attendees to participate.
4. Vendor and Sponsor Management: Event
organizers can coordinate with vendors and
sponsors, manage contracts, and handle logistics
seamlessly.
5. Seating Arrangement: For events requiring seating
arrangements, the app offers tools to design floor
plans and optimize seating for guests.
6. Communication Tools: Users can send event
updates, notifications, and announcements to
attendees through the app.
7. Analytics and Reporting: Robust data analytics
help organizers track attendee engagement, ticket
sales, and other key metrics.
8. Mobile Accessibility: The app is accessible on
mobile devices, ensuring that event organizers can
manage their events on the go.
10.Security and Privacy: Robust security measures
protect sensitive event data and ensure the privacy of
organizers and attendees.

The Event Management App aims to simplify the


complexities of event planning and execution while
enhancing the overall experience for both organizers
and participants. With its user-friendly interface and
comprehensive feature set, it offers a powerful solution
for event professionals and individuals seeking to host
successful and memorable gatherings.

This abstract provides a concise yet informative


overview of what the event management app is all
about, including its primary features and benefits. It
serves as a quick reference for potential users or
stakeholders who want to understand the app's
purpose and capabilities without delving into technical
details.

Activity_mainxml
Code:-
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_backdrop_height"
android:fitsSystemWindows="true"

android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"

app:expandedTitleTextAppearance="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">

<TextView
android:id="@+id/love_music"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@android:color/white"
android:textSize="@dimen/backdrop_title"
/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@android:color/white"

android:textSize="@dimen/backdrop_subtitle" />

</LinearLayout>
</RelativeLayout>

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"

app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>

<include layout="@layout/content_main" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Acticvitymain.xml

Code:-

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

</RelativeLayout>

Activitymain.java

Code:-

package event.management;

import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.google.android.material.appbar.AppBarLayout;
import
com.google.android.material.appbar.CollapsingToolbarLayout;

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

public class MainActivity extends AppCompatActivity {

private RecyclerView recyclerView;


private AlbumsAdapter adapter;
private List<Album> albumList;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

initCollapsingToolbar();

recyclerView = (RecyclerView)
findViewById(R.id.recycler_view);

albumList = new ArrayList<>();


adapter = new AlbumsAdapter(this, albumList);

RecyclerView.LayoutManager mLayoutManager = new


GridLayoutManager(this, 2);
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.addItemDecoration(new
GridSpacingItemDecoration(2, dpToPx(10), true));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);

prepareAlbums();

try {

Glide.with(this).load(R.drawable.pic1).into((ImageView)
findViewById(R.id.backdrop));
} catch (Exception e) {
e.printStackTrace();
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.action_notif:
Toast.makeText(MainActivity.this, "Notification
On",
Toast.LENGTH_LONG).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}

/**
* Initializing collapsing toolbar
* Will show and hide the toolbar title on scroll
*/
private void initCollapsingToolbar() {
final CollapsingToolbarLayout collapsingToolbar =
(CollapsingToolbarLayout)
findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle(" ");
AppBarLayout appBarLayout = (AppBarLayout)
findViewById(R.id.appbar);
appBarLayout.setExpanded(true);

// hiding & showing the title when toolbar expanded &


collapsed
appBarLayout.addOnOffsetChangedListener(new
AppBarLayout.OnOffsetChangedListener() {
boolean isShow = false;
int scrollRange = -1;

@Override
public void onOffsetChanged(AppBarLayout
appBarLayout, int verticalOffset) {
if (scrollRange == -1) {
scrollRange =
appBarLayout.getTotalScrollRange();
}
if (scrollRange + verticalOffset == 0) {

collapsingToolbar.setTitle(getString(R.string.app_name));
isShow = true;
} else if (isShow) {
collapsingToolbar.setTitle(" ");
isShow = false;
}
}
});
}

/**
* Adding few albums for testing
*/
private void prepareAlbums() {
int[] covers = new int[]{
R.drawable.general,
R.drawable.aue,
R.drawable.cse,
R.drawable.ec,
R.drawable.eee,
R.drawable.me,
R.drawable.mtr,
R.drawable.mca,
R.drawable.album9,
R.drawable.album10,
R.drawable.album11};

Album a = new Album("GENERAL", 5, covers[0]);


albumList.add(a);

a = new Album("AUTOMOBILE", 11, covers[1]);


albumList.add(a);

a = new Album("COMPUTER SCIENCE", 17, covers[2]);


albumList.add(a);

a = new Album("ELECTRONICS AND COMMUNICATION", 10,


covers[3]);
albumList.add(a);

a = new Album("ELECTRICAL AND ELECTRONICS", 7,


covers[4]);
albumList.add(a);

a = new Album("MECHANICAL", 8, covers[5]);


albumList.add(a);

a = new Album("MECHATRONICS", 8, covers[6]);


albumList.add(a);

a = new Album("MASTER OF COMPUTER APPLICATIONS", 3,


covers[7]);
albumList.add(a);

//a = new Album("Hello", 11, covers[8]);


//albumList.add(a);

//a = new Album("Greatest Hits", 17, covers[9]);


//albumList.add(a);

adapter.notifyDataSetChanged();
}

/**
* RecyclerView item decoration - give equal margin around
grid item
*/
public class GridSpacingItemDecoration extends
RecyclerView.ItemDecoration {

private int spanCount;


private int spacing;
private boolean includeEdge;

public GridSpacingItemDecoration(int spanCount, int


spacing, boolean includeEdge) {
this.spanCount = spanCount;
this.spacing = spacing;
this.includeEdge = includeEdge;
}

@Override
public void getItemOffsets(Rect outRect, View view,
RecyclerView parent, RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view);
// item position
int column = position % spanCount; // item column

if (includeEdge) {
outRect.left = spacing - column * spacing /
spanCount; // spacing - column * ((1f / spanCount) * spacing)
outRect.right = (column + 1) * spacing /
spanCount; // (column + 1) * ((1f / spanCount) * spacing)

if (position < spanCount) { // top edge


outRect.top = spacing;
}
outRect.bottom = spacing; // item bottom
} else {
outRect.left = column * spacing / spanCount; //
column * ((1f / spanCount) * spacing)
outRect.right = spacing - (column + 1) * spacing
/ spanCount; // spacing - (column + 1) * ((1f / spanCount) *
spacing)
if (position >= spanCount) {
outRect.top = spacing; // item top
}
}
}
}

/**
* Converting dp to pixel
*/
private int dpToPx(int dp) {
Resources r = getResources();
return
Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
dp, r.getDisplayMetrics()));
}

Output:-
Splash.screen_xml

Code:-

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/album_title">

<ImageView
android:id="@+id/imgLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:foregroundGravity="center_horizontal"
android:src="@drawable/edgeicon" />

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:gravity="center_horizontal"
android:text="NSITE 2k19"
android:textColor="@color/viewBg"
android:textSize="12dp" />

</RelativeLayout>

Splash activity.java

Code:-

package event.management;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

public class SplashScreen extends Activity {

// Splash screen timer


private static int SPLASH_TIME_OUT = 1500;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);

new Handler().postDelayed(new Runnable() {

/*
* Showing splash screen with a timer. This will be
useful when you
* want to show case your app logo / company
*/

@Override
public void run() {
// This method will be executed once the timer
is over
// Start your app main activity
Intent i = new Intent(SplashScreen.this,
MainActivity.class);
startActivity(i);

// close this activity


finish();
}
}, SPLASH_TIME_OUT);
}
Output:-

Album_card.xml

Code:-

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="@dimen/card_margin"
android:elevation="3dp"
card_view:cardCornerRadius="@dimen/card_album_radius">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="@dimen/album_cover_height"

android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:scaleType="fitXY" />

<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/thumbnail"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:paddingTop="@dimen/album_title_padding"
android:textColor="@color/album_title"
android:textSize="@dimen/album_title" />

<TextView
android:id="@+id/count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title"

android:paddingBottom="@dimen/songs_count_padding_bottom"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:textSize="@dimen/songs_count" />

<ImageView
android:id="@+id/overflow"
android:layout_width="@dimen/ic_album_overflow_width"

android:layout_height="@dimen/ic_album_overflow_height"
android:layout_alignParentRight="true"
android:layout_below="@id/thumbnail"

android:layout_marginTop="@dimen/ic_album_overflow_margin_top"
android:layout_marginRight="5dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_insta" />

</RelativeLayout>

</androidx.cardview.widget.CardView>

</LinearLayout>

Album.java

Code:-

package event.management;

/**
* Created by Lincoln on 18/05/16.
*/
public class Album {
private String name;
private int numOfSongs;
private int thumbnail;

public Album() {
}

public Album(String name, int numOfSongs, int thumbnail) {


this.name = name;
this.numOfSongs = numOfSongs;
this.thumbnail = thumbnail;
}

public String getName() {


return name;
}

public void setName(String name) {


this.name = name;
}
public int getNumOfSongs() {
return numOfSongs;
}

public void setNumOfSongs(int numOfSongs) {


this.numOfSongs = numOfSongs;
}

public int getThumbnail() {


return thumbnail;
}

public void setThumbnail(int thumbnail) {


this.thumbnail = thumbnail;
}
}

Output:-

Albums adapter java

Code:-

package event.management;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;

import java.util.List;

/**
* Created by Ravi Tamada on 18/05/16.
*/
public class AlbumsAdapter extends
RecyclerView.Adapter<AlbumsAdapter.MyViewHolder> {

private Context mContext;


private List<Album> albumList;

public class MyViewHolder extends RecyclerView.ViewHolder {


public TextView title, count;
public ImageView thumbnail, overflow;

public MyViewHolder(View view) {


super(view);
title = (TextView) view.findViewById(R.id.title);
count = (TextView) view.findViewById(R.id.count);
thumbnail = (ImageView)
view.findViewById(R.id.thumbnail);
overflow = (ImageView)
view.findViewById(R.id.overflow);
}
}

public AlbumsAdapter(Context mContext, List<Album> albumList)


{
this.mContext = mContext;
this.albumList = albumList;
}

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int
viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.album_card, parent, false);

return new MyViewHolder(itemView);


}
@Override
public void onBindViewHolder(final MyViewHolder holder, int
position) {
Album album = albumList.get(position);
holder.title.setText(album.getName());
holder.count.setText(album.getNumOfSongs() + " events");

// loading album cover using Glide library

Glide.with(mContext).load(album.getThumbnail()).into(holder.thumb
nail);

holder.thumbnail.setOnClickListener(new
View.OnClickListener() {

String getname = holder.title.getText().toString();

@Override
public void onClick(View v) {
// Do something
Intent editintent = new Intent(mContext,
EventActivity.class);
editintent.putExtra("deptname", getname);
mContext.startActivity(editintent);
}
});

holder.itemView.setOnClickListener(new
View.OnClickListener() {

String getname = holder.title.getText().toString();

@Override
public void onClick(View v) {
// Do something
Intent editintent = new Intent(mContext,
EventActivity.class);
editintent.putExtra("deptname", getname);
mContext.startActivity(editintent);
}
});

holder.overflow.setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View view) {
//showPopupMenu(holder.overflow);
Uri uri =
Uri.parse("https://instagram.com/nsite2k19?
utm_source=ig_profile_share&igshid=vmqpaurfflt3");

String getname =
holder.title.getText().toString();
if( getname.equals( "COMPUTER SCIENCE" ) ) {
uri =
Uri.parse("https://instagram.com/brocode2k19?
utm_source=ig_profile_share&igshid=122widnt5ycks");
}
else if( getname.equals( "MECHANICAL" ) ) {
uri =
Uri.parse("https://instagram.com/mechmerize2019?
utm_source=ig_profile_share&igshid=16ry9c2bgqx1n");
}
else if( getname.equals( "MECHATRONICS" ) ) {
uri =
Uri.parse("https://instagram.com/yantrikxix?
utm_source=ig_profile_share&igshid=5pigno1tfx0k");
}
else if( getname.equals( "ELECTRONICS AND
COMMUNICATION" ) ) {
uri =
Uri.parse("https://www.instagram.com/eclectique2k19_/");
}
else {
uri =
Uri.parse("https://instagram.com/nsite2k19?
utm_source=ig_profile_share&igshid=vmqpaurfflt3");
}

Intent likeIng = new Intent(Intent.ACTION_VIEW,


uri);
likeIng.setPackage("com.instagram.android");

try {
mContext.startActivity(likeIng);
} catch (ActivityNotFoundException e) {
mContext.startActivity(new
Intent(Intent.ACTION_VIEW,
Uri.parse("http://instagram.com/")));
}
}
});

}
/**
* Showing popup menu when tapping on 3 dots
*/
/*
private void showPopupMenu(View view) {
// inflate menu
PopupMenu popup = new PopupMenu(mContext, view);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_album, popup.getMenu());
popup.setOnMenuItemClickListener(new
MyMenuItemClickListener());
popup.show();
}
*/
/**
* Click listener for popup menu items
*/
/*
class MyMenuItemClickListener implements
PopupMenu.OnMenuItemClickListener {

public MyMenuItemClickListener() {
}

@Override
public boolean onMenuItemClick(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.action_add_favourite:
Toast.makeText(mContext, "Add to favourite",
Toast.LENGTH_SHORT).show();
return true;
case R.id.action_play_next:
Toast.makeText(mContext, "Play next",
Toast.LENGTH_SHORT).show();
return true;
default:
}
return false;
}
}
*/

@Override
public int getItemCount() {
return albumList.size();
}
}
Album_card.xml

Code:-

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="@dimen/card_margin"
android:elevation="3dp"
card_view:cardCornerRadius="@dimen/card_album_radius">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="@dimen/album_cover_height"

android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:scaleType="fitXY" />

<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/thumbnail"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:paddingTop="@dimen/album_title_padding"
android:textColor="@color/album_title"
android:textSize="@dimen/album_title" />

<TextView
android:id="@+id/count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title"

android:paddingBottom="@dimen/songs_count_padding_bottom"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:textSize="@dimen/songs_count" />

<ImageView
android:id="@+id/overflow"

android:layout_width="@dimen/ic_album_overflow_width"

android:layout_height="@dimen/ic_album_overflow_height"
android:layout_alignParentRight="true"
android:layout_below="@id/thumbnail"

android:layout_marginTop="@dimen/ic_album_overflow_margin_top"
android:layout_marginRight="5dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_call" />

</RelativeLayout>

</androidx.cardview.widget.CardView>

</LinearLayout>

Album card2_xml

Code:-

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="@dimen/card_margin"
android:elevation="3dp"
card_view:cardCornerRadius="@dimen/card_album_radius">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="@dimen/album_cover_height"

android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:scaleType="fitXY" />

<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/thumbnail"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:paddingTop="@dimen/album_title_padding"
android:textColor="@color/album_title"
android:textSize="@dimen/album_title" />

<TextView
android:id="@+id/count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title"

android:paddingBottom="@dimen/songs_count_padding_bottom"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:textSize="@dimen/songs_count" />

<ImageView
android:id="@+id/overflow"

android:layout_width="@dimen/ic_album_overflow_width"

android:layout_height="@dimen/ic_album_overflow_height"
android:layout_alignParentRight="true"
android:layout_below="@id/thumbnail"

android:layout_marginTop="@dimen/ic_album_overflow_margin_top"
android:layout_marginRight="5dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_call" />

</RelativeLayout>

</androidx.cardview.widget.CardView>

</LinearLayout>

Albums adapter2.java

Code:-

package event.management;

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

import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;

import java.util.List;

/**
* Created by Ravi Tamada on 18/05/16.
*/
public class AlbumsAdapter2 extends
RecyclerView.Adapter<AlbumsAdapter2.MyViewHolder> {

private Context mContext;


private List<Album> albumList;

public class MyViewHolder extends RecyclerView.ViewHolder {


public TextView title, count;
public ImageView thumbnail, overflow;

public MyViewHolder(View view) {


super(view);
title = (TextView) view.findViewById(R.id.title);
count = (TextView) view.findViewById(R.id.count);
thumbnail = (ImageView)
view.findViewById(R.id.thumbnail);
overflow = (ImageView)
view.findViewById(R.id.overflow);
}
}

public AlbumsAdapter2(Context mContext, List<Album>


albumList) {
this.mContext = mContext;
this.albumList = albumList;
}

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int
viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.album_card2, parent, false);

return new MyViewHolder(itemView);


}

@Override
public void onBindViewHolder(final MyViewHolder holder, int
position) {
Album album = albumList.get(position);
holder.title.setText(album.getName());
//holder.count.setText(album.getNumOfSongs() + "
songs");

// loading album cover using Glide library

Glide.with(mContext).load(album.getThumbnail()).into(holder.thumb
nail);

holder.thumbnail.setOnClickListener(new
View.OnClickListener() {

String getname = holder.title.getText().toString();

@Override
public void onClick(View v) {
// Do something
Intent editintent = new Intent(mContext,
DescActivity.class);
editintent.putExtra("eventname", getname);
mContext.startActivity(editintent);
}
});

holder.itemView.setOnClickListener(new
View.OnClickListener() {

String getname = holder.title.getText().toString();

@Override
public void onClick(View v) {
// Do something
Intent editintent = new Intent(mContext,
DescActivity.class);
editintent.putExtra("eventname", getname);
mContext.startActivity(editintent);
}
});

holder.overflow.setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View view) {
//showPopupMenu(holder.overflow);
}
});
}

/**
* Showing popup menu when tapping on 3 dots
*/
/*
private void showPopupMenu(View view) {
// inflate menu
PopupMenu popup = new PopupMenu(mContext, view);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_album, popup.getMenu());
popup.setOnMenuItemClickListener(new
MyMenuItemClickListener());
popup.show();
}
*/

/**
* Click listener for popup menu items
*/
/*
class MyMenuItemClickListener implements
PopupMenu.OnMenuItemClickListener {

public MyMenuItemClickListener() {
}

@Override
public boolean onMenuItemClick(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.action_add_favourite:
Toast.makeText(mContext, "Add to favourite",
Toast.LENGTH_SHORT).show();
return true;
case R.id.action_play_next:
Toast.makeText(mContext, "Play next",
Toast.LENGTH_SHORT).show();
return true;
default:
}
return false;
}
}
*/

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

Output:-

Descactivity_xml

Code:-
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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"
android:background="@color/cardview_dark_background">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|start"
android:orientation="vertical">

<androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"

android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>

<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:layout_marginRight="25dp"
android:text="Heading"
android:textColor="@color/cardview_light_background"
android:textSize="30sp" />

<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="400dp"
android:layout_gravity="center_horizontal"
app:srcCompat="@drawable/album1" />

<TextView
android:id="@+id/textView7"
android:layout_width="match_parent"
android:layout_height="223dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:layout_marginRight="10dp"
android:text="TextView"
android:textColor="@android:color/darker_gray" />

</LinearLayout>
</ScrollView>

Descactivity_java

Code:-

package event.management;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

public class DescActivity extends AppCompatActivity {


public String eventname;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.desc_main);
Toolbar toolbar = (Toolbar)
findViewById(R.id.my_toolbar);
setSupportActionBar(toolbar);
TextView t6 = (TextView) findViewById(R.id.textView6);
ImageView i = (ImageView) findViewById(R.id.imageView2);
TextView t7 = (TextView) findViewById(R.id.textView7);

Intent iin = getIntent();


Bundle b = iin.getExtras();

if (b != null) {
eventname = (String) b.get("eventname");
//eventname = j;
/* Toast.makeText(DescActivity.this, eventname,
Toast.LENGTH_LONG).show();*/
}
if (eventname.equals("QUIZ")) {
t6.setText(eventname);
i.setImageResource(R.drawable.quiz);
t7.setText("“Qriosity” The General Quiz Competition\
n" +
"“The only source of knowledge is
experience”-Albert Einstein\n" +
"\n" +
"Details below : \n" +
"\n" +
"Date: Wednesday,13 February 2019\n" +
"\n" +
"Timings :Registration begins at 10AM.Prelims
of the quiz begins at 12AM,followed by finals.\n" +
"\n" +
"Prizes worth over Rs.3000/-\n" +
"\n" +
"Venue:Brahmaguptha Hall,NCERC \n" +
"\n" +
"\n" +
"\n" +
"\n" +
"Cordinators:\n" +
"\n" +
"Rafeek T S: 9946289298\n" +
"\n" +
"Rahul .R : 8111976193\n" +
"\n" +
"Expect questions from any topic under the
sun!!!\n" +
"\n" +
"General Rules And Regulations:\n" +
"\n" +
"1.\tA team can consist of maximum 2
members .Lone wolves are permitted.\n" +
"\n" +
"2.\tThere will be a preliminary round
followed by the finals.\n" +
"\n" +
"3.\tTop 6 teams from the prelims will
qualify to the finals.\n" +
"\n" +
"4.\tAny numbers of teams from an institution
are allowed.\n" +
"\n" +
"5.\tRegistration for event will be separate
and the registration fee per team is Rs.50.\n" +
"\n" +
"6.\tParticipants must produce a valid ID
card during registration.\n" +
"\n" +
"7.\tThe rules of the quiz and it’s format
for each round will be explained by the quizmaster on the day of
the event prior to the round.\n" +
"\n" +
"8.\tAll decisions of the quiz master shall
be final and binding.\n" +
"\n" +
"\n" +
"Hope to see you all participate and win
amazing prizes at Qriosity 2019.Till then ,happy quizzing!");
}
}
}

Output:-

eventmain.xml

code:-

<?xml version="1.0" encoding="utf-8"?>


<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
android:orientation="vertical">

<androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<RelativeLayout
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:background="@color/viewBg"

app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="event.management.EventActivity">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:clipToPadding="false"
android:scrollbars="vertical" />

</RelativeLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Eventactivity.java

Code:-

package event.management;

import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;

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

public class EventActivity extends AppCompatActivity {


private RecyclerView recyclerView;
private AlbumsAdapter2 adapter;
private List<Album> albumList;
public String deptname;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.event_main);

Intent iin= getIntent();


Bundle b = iin.getExtras();

if(b!=null)
{
deptname =(String) b.get("deptname");
//eventname = j;
/*Toast.makeText(EventActivity.this, deptname,
Toast.LENGTH_LONG).show();*/
}

Toolbar toolbar = (Toolbar)


findViewById(R.id.my_toolbar);
setSupportActionBar(toolbar);

recyclerView = (RecyclerView)
findViewById(R.id.recycler_view2);

albumList = new ArrayList<>();


adapter = new AlbumsAdapter2(this, albumList);

RecyclerView.LayoutManager mLayoutManager = new


GridLayoutManager(this, 1);
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.addItemDecoration(new
EventActivity.GridSpacingItemDecoration(1, dpToPx(10), true));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);

if( deptname.equals("GENERAL") ) {
prepareAlbums1();
}
else if ( deptname.equals("AUTOMOBILE") ) {
prepareAlbums2();
}
else if ( deptname.equals("COMPUTER SCIENCE") ) {
prepareAlbums3();
}
else if ( deptname.equals("ELECTRONICS AND
COMMUNICATION") ) {
prepareAlbums4();
}
else if ( deptname.equals("ELECTRICAL AND ELECTRONICS") )
{
prepareAlbums5();
}
else if ( deptname.equals("MECHANICAL") ) {
prepareAlbums6();
}
else if ( deptname.equals("MECHATRONICS") ) {
prepareAlbums7();
}
else if ( deptname.equals("MASTER OF COMPUTER
APPLICATIONS") ) {
prepareAlbums8();
}

try {

Glide.with(this).load(R.drawable.cover).into((ImageView)
findViewById(R.id.backdrop));
} catch (Exception e) {
e.printStackTrace();
}
}
private void prepareAlbums1() {
int[] covers = new int[]{
R.drawable.expo,
R.drawable.quiz,
R.drawable.strike,
R.drawable.p1,
R.drawable.p2,
R.drawable.album6,
R.drawable.album7,
R.drawable.album8,
R.drawable.album9,
R.drawable.album10,
R.drawable.album11};

Album a = new Album("MOTO EXPO", 13, covers[0]);


albumList.add(a);

a = new Album("QUIZ", 8, covers[1]);


albumList.add(a);

a = new Album("STRIKE A POSE", 8, covers[2]);


albumList.add(a);

a = new Album("ENGINEERING PROJECTS", 8, covers[3]);


albumList.add(a);

a = new Album("PROJECTS (HIGH SCHOOL LEVEL and HIGHER


SECONDARY LEVEL)", 8, covers[4]);
albumList.add(a);

adapter.notifyDataSetChanged();
}

/**
* Adding few albums for testing
*/
private void prepareAlbums2() {
int[] covers = new int[]{
R.drawable.gear,
R.drawable.deci,
R.drawable.skill,
R.drawable.hill,
R.drawable.offro,
R.drawable.lady,
R.drawable.gokart,
R.drawable.motography,
R.drawable.auto,
R.drawable.stuntshow,
R.drawable.projectpresent};

Album a = new Album("GEARBOX ASSEMBLING", 13, covers[0]);


albumList.add(a);

a = new Album("DECIBEL TEST", 8, covers[1]);


albumList.add(a);

a = new Album("SKILLED DRIVER", 11, covers[2]);


albumList.add(a);

a = new Album("HILL CLIMBING", 12, covers[3]);


albumList.add(a);

a = new Album("OFFROAD CYCLING", 14, covers[4]);


albumList.add(a);

a = new Album("LADIES! START", 1, covers[5]);


albumList.add(a);

a = new Album("GO-KART RIDE", 1, covers[6]);


albumList.add(a);

a = new Album("MOTOGRAPHY", 11, covers[7]);


albumList.add(a);

a = new Album("AUTOLAPSE", 14, covers[8]);


albumList.add(a);

a = new Album("STUNT SHOW", 11, covers[9]);


albumList.add(a);

a = new Album("PROJECT PRESENTATION", 17, covers[10]);


albumList.add(a);

adapter.notifyDataSetChanged();
}

private void prepareAlbums3() {


int[] covers = new int[]{
R.drawable.food,
R.drawable.machine,
R.drawable.photobooth,
R.drawable.fog,
R.drawable.scavangr,
R.drawable.hardwareassembling5,
R.drawable.blindcodingportrait501,
R.drawable.arhunt,
R.drawable.paintball501,
R.drawable.blindpen,
R.drawable.blindpen,
R.drawable.blindpen,
R.drawable.blindpen,
R.drawable.blindpen,
R.drawable.blindpen,
R.drawable.blindpen,
R.drawable.projectpresent};

Album a = new Album("FOOD MANIA", 13, covers[0]);


albumList.add(a);

a = new Album("MACHINE BULL", 8, covers[1]);


albumList.add(a);

a = new Album("PHOTOBOOTH", 11, covers[2]);


albumList.add(a);

a = new Album("FOG ILLUSION", 12, covers[3]);


albumList.add(a);

a = new Album("SCAVENGER HUNT", 14, covers[4]);


albumList.add(a);

a = new Album("HARDWARE ASSEMBLING", 1, covers[5]);


albumList.add(a);

a = new Album("BLIND CODING", 11, covers[6]);


albumList.add(a);

a = new Album("AR HUNT", 14, covers[7]);


albumList.add(a);

a = new Album("PAINT BALL", 11, covers[8]);


albumList.add(a);

a = new Album("BLIND PENALTY", 17, covers[9]);


albumList.add(a);

a = new Album("TENNIS SMASH", 17, covers[10]);


albumList.add(a);

a = new Album("FIFA", 17, covers[11]);


albumList.add(a);

a = new Album("NFS", 17, covers[12]);


albumList.add(a);

a = new Album("PUBG", 17, covers[13]);


albumList.add(a);

a = new Album("RUBIX CUBE", 17, covers[14]);


albumList.add(a);

a = new Album("DIGIMANIA", 17, covers[15]);


albumList.add(a);

a = new Album("MACHINE LEARNING USING PYTHON", 17,


covers[16]);
albumList.add(a);

adapter.notifyDataSetChanged();
}

private void prepareAlbums4() {


int[] covers = new int[]{
R.drawable.food,
R.drawable.machine,
R.drawable.photobooth,
R.drawable.fog,
R.drawable.scavangr,
R.drawable.hardwareassembling5,
R.drawable.blindcodingportrait501,
R.drawable.arhunt,
R.drawable.paintball501,
R.drawable.blindpen,
R.drawable.projectpresent};

Album a = new Album("TRICKY CIRCUITS", 13, covers[0]);


albumList.add(a);

a = new Album("CIRCUITRIX", 8, covers[1]);


albumList.add(a);

a = new Album("GOOGLE HUNT", 11, covers[2]);


albumList.add(a);

a = new Album("DEAM FACTORY", 12, covers[3]);


albumList.add(a);
a = new Album("INNOVANCE (Paper Presentation)", 14,
covers[4]);
albumList.add(a);

a = new Album("V R GAMING", 1, covers[5]);


albumList.add(a);

a = new Album("FLUORO SOCCER 2019", 11, covers[6]);


albumList.add(a);

a = new Album("RAM & ROM", 14, covers[7]);


albumList.add(a);

a = new Album("OPTICAL VILLAGE", 14, covers[8]);


albumList.add(a);

a = new Album("DRONE SHOW", 14, covers[9]);


albumList.add(a);

adapter.notifyDataSetChanged();
}

private void prepareAlbums5() {


int[] covers = new int[]{
R.drawable.food,
R.drawable.machine,
R.drawable.photobooth,
R.drawable.fog,
R.drawable.scavangr,
R.drawable.hardwareassembling5,
R.drawable.blindcodingportrait501,
R.drawable.arhunt,
R.drawable.paintball501,
R.drawable.blindpen,
R.drawable.projectpresent};

Album a = new Album("CIRCUIT DEBUGGING", 13, covers[0]);


albumList.add(a);

a = new Album("BOMB DIFFUSION", 8, covers[1]);


albumList.add(a);

a = new Album("ROBOSTRIKE", 11, covers[2]);


albumList.add(a);

a = new Album("CONTRAPTION", 12, covers[3]);


albumList.add(a);
a = new Album("CORNER OF CHAOS", 14, covers[4]);
albumList.add(a);

a = new Album("KSEB EXPO", 1, covers[5]);


albumList.add(a);

a = new Album("AUTONOMOUS ROBOTICS", 11, covers[6]);


albumList.add(a);

adapter.notifyDataSetChanged();
}

private void prepareAlbums6() {


int[] covers = new int[]{
R.drawable.food,
R.drawable.machine,
R.drawable.photobooth,
R.drawable.fog,
R.drawable.scavangr,
R.drawable.hardwareassembling5,
R.drawable.blindcodingportrait501,
R.drawable.arhunt,
R.drawable.paintball501,
R.drawable.blindpen,
R.drawable.projectpresent};

Album a = new Album("PIT STOP", 13, covers[0]);


albumList.add(a);

a = new Album("HYDRO LAUNCH", 8, covers[1]);


albumList.add(a);

a = new Album("CAD MODELLING", 11, covers[2]);


albumList.add(a);

a = new Album("GAME OF THRONES", 12, covers[3]);


albumList.add(a);

a = new Album("FOAM FOOTBALL", 14, covers[4]);


albumList.add(a);

a = new Album("SUMO WRESTLING", 1, covers[5]);


albumList.add(a);

a = new Album("ARCHERY", 11, covers[6]);


albumList.add(a);
a = new Album("E- mobility skill development workshop",
14, covers[7]);
albumList.add(a);

adapter.notifyDataSetChanged();
}

private void prepareAlbums7() {


int[] covers = new int[]{
R.drawable.food,
R.drawable.machine,
R.drawable.photobooth,
R.drawable.fog,
R.drawable.scavangr,
R.drawable.hardwareassembling5,
R.drawable.blindcodingportrait501,
R.drawable.arhunt,
R.drawable.paintball501,
R.drawable.blindpen,
R.drawable.projectpresent};

Album a = new Album("CLASH OF BOTS (ROBOWAR)", 13,


covers[0]);
albumList.add(a);

a = new Album("DIRT RACE (ROBORACE)", 8, covers[1]);


albumList.add(a);

a = new Album("ROBO SOCCER", 11, covers[2]);


albumList.add(a);

a = new Album("LINE FOLLOWER", 12, covers[3]);


albumList.add(a);

a = new Album("TRANSPORTER", 14, covers[4]);


albumList.add(a);

a = new Album("RC RACE", 1, covers[5]);


albumList.add(a);

a = new Album("RC SHOW", 11, covers[6]);


albumList.add(a);

a = new Album("ROBO EXPO", 14, covers[7]);


albumList.add(a);
adapter.notifyDataSetChanged();
}

private void prepareAlbums8() {


int[] covers = new int[]{
R.drawable.food,
R.drawable.machine,
R.drawable.photobooth,
R.drawable.fog,
R.drawable.scavangr,
R.drawable.hardwareassembling5,
R.drawable.blindcodingportrait501,
R.drawable.arhunt,
R.drawable.paintball501,
R.drawable.blindpen,
R.drawable.projectpresent};

Album a = new Album("BRAIN OF TEQTIS", 13, covers[0]);


albumList.add(a);

a = new Album("MINUTE TO WIN IT", 8, covers[1]);


albumList.add(a);

a = new Album("Kalaprabha", 11, covers[2]);


albumList.add(a);

adapter.notifyDataSetChanged();
}

/**
* RecyclerView item decoration - give equal margin around
grid item
*/
public class GridSpacingItemDecoration extends
RecyclerView.ItemDecoration {

private int spanCount;


private int spacing;
private boolean includeEdge;

public GridSpacingItemDecoration(int spanCount, int


spacing, boolean includeEdge) {
this.spanCount = spanCount;
this.spacing = spacing;
this.includeEdge = includeEdge;
}
@Override
public void getItemOffsets(Rect outRect, View view,
RecyclerView parent, RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view);
// item position
int column = position % spanCount; // item column

if (includeEdge) {
outRect.left = spacing - column * spacing /
spanCount; // spacing - column * ((1f / spanCount) * spacing)
outRect.right = (column + 1) * spacing /
spanCount; // (column + 1) * ((1f / spanCount) * spacing)

if (position < spanCount) { // top edge


outRect.top = spacing;
}
outRect.bottom = spacing; // item bottom
} else {
outRect.left = column * spacing / spanCount; //
column * ((1f / spanCount) * spacing)
outRect.right = spacing - (column + 1) * spacing
/ spanCount; // spacing - (column + 1) * ((1f / spanCount) *
spacing)
if (position >= spanCount) {
outRect.top = spacing; // item top
}
}
}
}

/**
* Converting dp to pixel
*/
private int dpToPx(int dp) {
Resources r = getResources();
return
Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
dp, r.getDisplayMetrics()));
}
}

Output:-
Content_main.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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/viewBg"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="event.management.MainActivity"
tools:showIn="@layout/activity_main">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbars="vertical" />

</RelativeLayout>

Content_main.xml
Code:-

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

</RelativeLayout>

Output:-

Android manifest.xml

Code:-

<?xml version="1.0" encoding="utf-8"?>


<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="event.management">

<application
android:allowBackup="true"
android:icon="@drawable/edgeicon"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- Splash screen -->
<activity
android:name=".SplashScreen"
android:exported="true"
android:screenOrientation="portrait"

android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"
/>

<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="false"

android:theme="@style/AppTheme.NoActionBar"></activity>
<activity
android:name=".EventActivity"
android:exported="false"

android:theme="@style/AppTheme.NoActionBar"></activity>
<activity
android:name=".DescActivity"
android:exported="false"

android:theme="@style/AppTheme.NoActionBar"></activity>
</application>

</manifest>

Gradle script:-

plugins {
id 'com.android.application'
}

android {
namespace 'event.management'
compileSdk 33

defaultConfig {
applicationId "event.management"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-
android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation
'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.github.bumptech.glide:glide:4.15.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-
core:3.5.1'

You might also like