Professional Documents
Culture Documents
The Calendar Provider is a repository for a user's calendar events. The Calendar
Provider API allows you to perform query, insert, update, and delete operations on
calendars, events, attendees, reminders, and so on. The Calendar Provider API can be used
by applications and sync adapters. The rules vary depending on what type of program is
making the calls. This document focuses primarily on using the Calendar Provider API as an
application. It is read or write calendar data, an application's manifest must include the
proper permissions, described in User Permissions. To make performing common
operations easier, the Calendar Provider offers a set of intents, as described in Calendar
Intents. These intents take users to the Calendar application to insert, view, and edit events.
The user interacts with the Calendar application and then returns to the original application.
Thus your application doesn't need to request permissions, nor does it need to provide a
user interface to view or create events.
COURSE OUTCOMES :
https://www.w3schools.in/android-tutorial/intro/#
https://developer.android.com/guide/topics/providers/calendar-provider
CalendarView:
This class is a calendar widget for displaying and selecting dates. The range of
dates supported by this calendar is configurable. It also provides the selection of the
current date and displaying the date.
• Interface:
CalendarView.OnDateChangeListener
The callback used to indicate the user changes the date.
• Syntax:
<CalendarView>
//code
</CalenderView>
• Attributes of CalendarView:
1. android:dateTextAppearance :-The text appearance for the day numbers in
the calendar grid.
2. android:firstDayOfWeek :-Defines first day of the calendar.
3.android:alpha :-Sets alpha to the view.
4. android:background :-Sets drawable to the background.
5. android:backgroundTint :-Sets tint to apply to the background.
6. android:clickable :-Specifies whether the view is clickable or not.
7. android:elevation :-Sets elevation of the view.
8. android:focusable :-Specifies whether this view can take focus or not.
9. android:id :-Specifies id of the view.
10. android:visibility :-Specifies the visibility(VISIBLE, INVISIBLE, GONE) of the
view.
TextView:
TextView displays text to the user and optionally allows them to edit it
programmatically. TextView Size of Plain, Large, Medium, and Small Text.
TextView is a complete text editor, however basic class is configured to not allow
editing but we can edit it. It is based on the layout size, style, and color etc.
• Interface
TextView.OnEditorActionListener
• Class
TextView.SavedState
• Syntax:
<TextView>
//code
</TextView>
• Attributes of TextView :
1. id: id is an attribute used to uniquely identify a text view. Below is the
example code in which we set the id of a text view.
2. gravity: The gravity attribute is an optional attribute which is used to
control the alignment of the text.
3. text: text attribute is used to set the text in a text view.
4. textColor: textColor attribute is used to set the text color of a text view.
5. textSize: textSize attribute is used to set the size of text of a text view.
6. textStyle: textStyle attribute is used to set the text style of a text view.
7. background: background attribute is used to set the background of a text
view.
8. padding: padding attribute is used to set the padding from left, right, top
or bottom.
9.alpha: It has a value between 0(entirely transparent) and 1
(completely Opaque)
10.auto: link Controls the links such as urls and email address are
automatically found and converted to clickable links.
XML CODE:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background2"
tools:context=".MainActivity"
tools:ignore="DuplicateIds">
<CalendarView
android:id="@+id/Cv"
android:layout_width="393dp"
android:layout_height="352dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.498" />
<TextView
android:id="@+id/Tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/Cv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.636"
tools:ignore="UnknownId" />
</android.support.constraint.ConstraintLayout>
JAVA CODE:
package com.example.calender;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.CalendarView;
import android.widget.TextView;
CalendarView Cv;
TextView Tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Cv= findViewById(R.id.Cv);
Tv= findViewById(R.id.Tv);
});
}
}
OUTPUT :
FUTURE SCOPE :
Calendars are useful tools for keeping track of upcoming meetings, deadlines, and
milestones. They can help you visualize your schedule and remind you of important events,
such as holidays and vacation time.
It’s no wonder that people often have a variety of calendar tools to choose from,
including everything from a paper calendar on their office wall to a calendar management
tool. The project will be useful for all peoples.
The problem is that people too often manage multiple calendars at once. When
these calendars aren’t integrated with your work and synchronized with each other, this can
lead to mass confusion, headaches, and missed deadlines.
CONCLUSION :
In this project we have studied about How to create Calendar in android studio. In this
project develop we have to use <CalendarView> tag for creating calendar and then we
create <TextView > tag for display current date. The Calendar Provider is a repository for a
user's calendar events. We use calendar in our everyday life. This calendar helps us known
as dates of any month or year.
REFERENCE :
https://www.w3schools.in/android-tutorial/intro/#
https://developer.android.com/guide/topics/providers/calendar-provider
https://developer.android.com/reference/android/widget/Button