0% found this document useful (0 votes)
18 views11 pages

Meeting Schedule App Development

The document contains XML code for layouts used in an Android app to display meeting schedule details. It includes code for the main activity layout, two fragments for scheduling meetings and viewing details, and their associated views and widgets. The layouts contain elements like text views, edit texts, buttons and a calendar view to enter and display meeting dates, times, and other details.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views11 pages

Meeting Schedule App Development

The document contains XML code for layouts used in an Android app to display meeting schedule details. It includes code for the main activity layout, two fragments for scheduling meetings and viewing details, and their associated views and widgets. The layouts contain elements like text views, edit texts, buttons and a calendar view to enter and display meeting dates, times, and other details.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 Program 9: Meeting Schedule

XML Code:
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<[Link]
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/design_default_color_error"
android:theme="@style/[Link]">

<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/purple_500"
android:gravity="center"
android:minHeight="?actionBarSize"
android:padding="@dimen/appbar_padding"
android:text="Meeting Details"
android:textAlignment="center"

android:textAppearance="@style/[Link]
e" />

<[Link]
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="37dp"
android:background="#FFEA6b"
app:tabIndicatorColor="#00E6FF" />
</[Link]>

<[Link]
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="499dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</[Link]>

</[Link]>

Mobile Application Development – 18CSMP68


2 Program 9: Meeting Schedule

[Link]:
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".[Link]">

<TextView
android:id="@+id/section_label"
android:text="Schedule Meeting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1" />

</[Link]>

[Link]:
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_height="match_parent">

<EditText
android:id="@+id/txtDate"
android:layout_width="212dp"
android:layout_height="50dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="DD/MM/YYYY"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/mDate"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/txtTime"
android:layout_width="212dp"
android:layout_height="54dp"
android:layout_marginTop="64dp"
android:layout_marginEnd="8dp"
android:ems="10"
android:hint="hh:mm"

Mobile Application Development – 18CSMP68


3 Program 9: Meeting Schedule

android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/txtDate" />

<TextView
android:id="@+id/mDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="20dp"
android:text="Date:"
android:textAppearance="@style/[Link]"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/txt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="Time:"
android:textAppearance="@style/[Link]"
app:layout_constraintEnd_toStartOf="@+id/txtTime"
app:layout_constraintHorizontal_bias="0.117"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mDate" />

<TextView
android:id="@+id/txt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="Meeting Agenda:"
android:textAppearance="@style/[Link]"
app:layout_constraintBottom_toTopOf="@+id/btn1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt2"
app:layout_constraintVertical_bias="0.131" />

<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Meeting Schedule"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.331"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtAgenda"
app:layout_constraintVertical_bias="0.782" />

<EditText
android:id="@+id/txtAgenda"
android:layout_width="212dp"
android:layout_height="50dp"
android:layout_marginTop="16dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/txt3"
app:layout_constraintTop_toBottomOf="@+id/txtTime" />

<CalendarView
Mobile Application Development – 18CSMP68
4 Program 9: Meeting Schedule

android:id="@+id/mCal"
android:layout_width="385dp"
android:layout_height="305dp"
android:background="#AFB42B"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.575" />
</[Link]>

[Link]:
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="Select Date to get Meeting Details"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/editTextDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.535"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2"
app:layout_constraintVertical_bias="0.047" />

<CalendarView
android:id="@+id/calendarView"
android:layout_width="263dp"
android:layout_height="249dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.679"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editTextDate" />

<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search to get Meeting Details"
app:layout_constraintBottom_toBottomOf="parent"

Mobile Application Development – 18CSMP68


5 Program 9: Meeting Schedule

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/calendarView"
app:layout_constraintVertical_bias="0.0" />
</[Link]>

Java Code:
package [Link];

import [Link];

import
[Link];
import [Link];
import [Link];

import [Link];
import [Link];

import [Link];
import [Link];
import [Link];

import [Link];

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
SectionsPagerAdapter sectionsPagerAdapter = new
SectionsPagerAdapter(this, getSupportFragmentManager());
ViewPager viewPager = findViewById([Link].view_pager);
[Link](sectionsPagerAdapter);
TabLayout tabs = findViewById([Link]);
[Link](viewPager);
}
}

[Link]:
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class DataBaseConn extends SQLiteOpenHelper {


public DataBaseConn(Context context) {
super(context,"[Link]",null,1);
}

Mobile Application Development – 18CSMP68


6 Program 9: Meeting Schedule

@Override
public void onCreate(SQLiteDatabase db) {
[Link]("create Table meetingTbl(date TEXT,time TEXT, agenda
TEXT)");

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
[Link]("drop Table if exists meetingTbl");

}
public boolean insertvalue(String d, String t, String agd){
SQLiteDatabase DB=[Link]();
ContentValues cv = new ContentValues();
[Link]("date",d);
[Link]("time",t);
[Link]("agenda",agd);
long res=[Link]("meetingTbl",null,cv); //query to insert
if(res==-1){
return false;
}
else
return true;
}
public Cursor fetch(String d){

SQLiteDatabase DB=[Link]();
// String sqlquery="select name from MDTbl where date='19/3/21' AND
time='Afternoon'";
// Cursor c = [Link](sqlquery,null);
Cursor c = [Link]("Select time,agenda from meetingTbl where
date='"+d+"' ",null);
return c;
}

[Link]:
package [Link];

import [Link];
import [Link];
import [Link];

import [Link];

public class DBMS extends SQLiteOpenHelper {


public DBMS(@Nullable Context context, @Nullable String name, @Nullable
[Link] factory, int version) {
super(context, name, factory, version);
}

@Override
public void onCreate(SQLiteDatabase db) {

Mobile Application Development – 18CSMP68


7 Program 9: Meeting Schedule

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {

}
}

[Link]:
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];

import static [Link];

public class Fragment1 extends Fragment {


EditText date,time,agenda;
DataBaseConn dbc;
CalendarView calendarView;
Button btn;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable
ViewGroup container, @Nullable Bundle savedInstanceState) {
View
view=[Link]([Link].fragment_layout1,container,false);
date=[Link]([Link]);
time=[Link]([Link]);
agenda=[Link]([Link]);
btn=[Link]([Link].btn1);
calendarView=[Link]([Link]);
dbc=new DataBaseConn(getActivity()); //need to initialize here
only
[Link]([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
closeKeyBoard();
[Link]([Link]);
[Link](new
[Link]() {
@Override
public void onSelectedDayChange(@NonNull CalendarView
view, int year, int month, int dayOfMonth) {
String d=dayOfMonth+"/"+(month+1)+"/"+year;
[Link](d);
[Link]([Link]);
}

Mobile Application Development – 18CSMP68


8 Program 9: Meeting Schedule

});
}
});
[Link](new [Link]() {
@Override
public void onClick(View v) {
String mdate,mTime,mAgenda;
mdate=[Link]().toString();
mTime=[Link]().toString();
mAgenda=[Link]().toString();

Boolean insert=[Link](mdate,mTime,mAgenda);
if(insert==true){
[Link](getActivity(),"Data
Inserted",Toast.LENGTH_SHORT).show();

}
else
[Link](getActivity(),"Data NOT
Inserted",Toast.LENGTH_SHORT).show();
//[Link]("NOT INSERTED");

});

return view;
}
private void closeKeyBoard(){
View view = getActivity().getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager)

getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
[Link]([Link](), 0);
}

[Link]:
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

Mobile Application Development – 18CSMP68


9 Program 9: Meeting Schedule

import [Link];
import [Link];

import [Link].R;

import [Link];

public class Fragment2 extends Fragment {


EditText date;
CalendarView cal;
Button btn1;
DataBaseConn dbc;
TextView t;
// String med="";
// String med1="";
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable
ViewGroup container, @Nullable Bundle savedInstanceState) {
View
view=[Link]([Link].fragment2_layout,container,false);
date=[Link]([Link]);
cal=[Link]([Link]);
btn1=[Link]([Link].btn2);
dbc=new DataBaseConn(getActivity());
// t=()

[Link](new [Link]()
{
@Override
public void onSelectedDayChange(@NonNull CalendarView view, int
year, int month, int dayOfMonth) {
String d=dayOfMonth+"/"+(month+1)+"/"+year;
[Link](d);
}
});

[Link](new [Link]() {
@Override
public void onClick(View v) {
String d1=[Link]().toString();
StringBuffer res=new StringBuffer();
Cursor c=[Link](d1);
int count=[Link]();
[Link]();
if(count>0) {
do {

[Link]([Link]([Link]("agenda"))+"\t"+"at"+"\t"+[Link]
ng([Link]("time")));
[Link]("\n");

//med =
([Link]([Link]([Link]("agenda"))));
//med1 =
([Link]([Link]([Link]("time"))));
}while ([Link]());
[Link](getActivity(), res,
Toast.LENGTH_LONG).show();
}
else
{
[Link](getActivity(), "No Meeting on This
Day....", Toast.LENGTH_LONG).show();
Mobile Application Development – 18CSMP68
10 Program 9: Meeting Schedule

}
});
return view;
}

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
[Link](savedInstanceState);

}
}

Mobile Application Development – 18CSMP68


11 Program 9: Meeting Schedule

Output:

Mobile Application Development – 18CSMP68

Common questions

Powered by AI

Fragment2.java facilitates data retrieval by using a CalendarView to select a date, triggering a database query to fetch meeting details for that date. The OnClickListener for the search button initiates the fetch function, which retrieves data and displays it using a Toast if meetings are scheduled, or informs the user through a Toast message if no meetings exist for the selected date. This immediate feedback ensures the user is aware of the app's state and operation success .

The rationale for using separate fragments for adding and viewing meeting details lies in promoting a modular approach, enhancing maintainability and scalability. Fragment1 focuses on adding new meeting schedules, while Fragment2 focuses on displaying scheduled meetings, thereby segregating responsibilities and allowing independent updates or extensions to functionality. This separation supports a clean architecture and improves user experience by providing task-focused interfaces .

The layout structure in the Meeting Schedule XML code is organized using the CoordinatorLayout as the parent layout, which contains an AppBarLayout and a ViewPager. The AppBarLayout features a TextView and a TabLayout for navigation, while the ViewPager manages fragments for different sections of the app. The layout uses constraints to define the positioning of interface elements, providing a responsive UI design .

ViewPager enables management of multiple fragments within the meeting scheduling application, allowing users to swipe between different sections or views seamlessly. It works in conjunction with the SectionsPagerAdapter to load the appropriate fragment based on the user's gesture or selection from the TabLayout. This provides a smooth experience and is crucial for organizing and navigating through various parts of the app, like adding or viewing meetings .

In the Android application discussed, the onCreate method is effectively used to define the database schema and tables upon the first creation of the database. The onUpgrade method is utilized to drop existing tables and recreate them, ensuring schema updates are managed effectively. These practices ensure database integrity and adaptability to changes, reducing the risk of data corruption and facilitating schema evolution without data loss when the app version changes .

The integration of SQLite database for managing meeting details involves creating a class that extends SQLiteOpenHelper, defining the database schema within the onCreate method, and methods for data manipulation such as insertvalue and fetch. The insertvalue method adds new records to the database, while fetch retrieves meetings by date. Additionally, this setup includes error handling to confirm successful data operations .

SectionsPagerAdapter acts as a bridge between the ViewPager and fragments by managing the fragments to be displayed based on user interactions. It extends FragmentPagerAdapter and is responsible for returning the correct fragment for each page, allowing MainActivity to switch seamlessly between these fragments, which handle different functionality like scheduling and retrieving meeting details .

The XML fragments contribute to user interaction by structuring the UI elements for seamless user input and feedback. Fragment1.xml contains EditText fields for entering date, time, and agenda of meetings, aligned with labels for clarity. Fragment2.xml facilitates the retrieval of meeting details by allowing users to select a date using a CalendarView, enhancing usability through interactive elements. Both fragments ensure alignment and color themes for consistency in design .

ConstraintLayout is used effectively in the meeting schedule interface to create complex layouts with ease, offering flexibility and performance advantages. It allows precise positioning of elements like EditText and TextView by setting constraints relative to other UI components and the parent layout, thereby ensuring a responsive design that adapts to various screen sizes while maintaining a clean UI. However, the complexity of constraints might increase development effort in designing the initial layout .

Data validation in Fragment1.java is partly achieved through the click listener of the date EditText, which ensures only valid dates are selected via CalendarView. Feedback is provided through Toast messages upon inserting data, informing users about the success or failure of data insertion to the SQLite database. These mechanisms ensure that users are aware of the status of their actions and that valid data is entered .

You might also like