Event Schedular in JAVA (Android Studio)

It only works as a event handler or time management tool but not as a complete package for all the members in this case users of the application.
Screenshot of the application is also attached below.
img

Tools:

This application will use two basic tools, Android Studio which is a development tool to create android applications that work for phones and tablets which use android system in it.

Android studio

img

Android Studio is the official integrated development environment (IDE) for Google's Android operating system, built on JetBrains' IntelliJ IDEA software and designed specifically for Android development.

It is available for download on Windows, macOS and Linux based operating systems.
It is a replacement for the Eclipse Android Development Tools (ADT) as primary IDE for native Android application development Android Studio will implement the Layout of the app, User interface of the application, also it will implement the functionalities of the application, like event name, date, and time and user info.

Android Studio uses Java programming language for the development. The Second tool used is Back4app, it is an online database storing server.

It works like database to save your data in it, it provides the limited space to store data also it is smoother than desktop databases like SQL, Back4app is a production ready environment for Parse deployment. It is the easiest migration path as the Parse migration guide suggests, you can migrate the Database and API to another BaaS provider or setup the required infrastructure (Parse Server + MongoDB instance) by yourself and migrate your app.

back4app is a great alternative for hosting your Parse app.
The developer don’t need to worry about rewriting the app using another API or learning how to use a new platform.

To make things even easier for you to get started, the back4app team has created a migration feature that makes it very easy to get your Parse app running in the back appBaaS.

In the database thee user log in information like Username and Password are saved, the event details such as the name, time, and date for the event are also stored in the database.

An activity is a single, focused thing that the user can do.
Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View).

While activities are often presented to the user as full-screen windows, they can also be used in other ways:
as floating windows (via a theme with windowIsFloating set) or embedded inside of another activity (using ActivityGroup).

There are two methods almost all subclasses of Activity will implement:

  • onCreate(Bundle) is where you initialize your activity. Most importantly, here you will usually call setContentView(int) with a layout resource defining your UI, and using findViewById(int) to retrieve the widgets in that UI that you need to interact with programmatically.
  • onPause() is where you deal with the user leaving your activity. Most importantly, any changes made by the user should at this point be committed (usually to the ContentProvider holding the data).

Following is a activity life cycle:

img

State Description

1) If an activity in the foreground of the screen (at the top of the stack), it is active or running.

2) If an activity has lost focus but is still visible (that is, a new non-full-sized or transparent activity has focus on top of your activity), it is paused. A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.

3) If an activity is completely obscured by another activity, it is stopped. It still retains all state and member information, however, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.

4) If an activity is paused or stopped, the system can drop the activity from memory by either asking it to finish, or simply killing its process. When it is displayed again to the user, it must be completely restarted and restored to its previous state.

Application is divided into seven activities as the logic works, following are the names of activity files.

  • AddEventActivity
  • EventApplication
  • HomeRecycleAdapter
  • LoginActivity
  • MainActivity
  • NotifyButtonReceiver
  • RegisterActivity

All the functionalities of the application are performed by these seven activity files which are created in Android Studio.

img

AddEventActivity:

The addEventActivity is derived class from AppCompatActivity, the private members of this class include private static int year, month, day;
TextView txtdate, txtTime;

ImageView imageView; 
Bitmap imageBitmap; 
String title;
int hour;
static int minute;
ProgressBar progressBar; RelativeLayout relativeLayout;

The public members of this class are:

public void selectEventDate(View v)
public void selectEventTime(View v)
public void selectImage(View view) public void showGallery()
private void showDate(int year, int month, int day)
private void setCurrentYearMonthDay()
public void btnSaveOnClick(View v)
private Calendar getSelectedCalender()
private void saveToParse()
private void saveToParse(ParseFile parseFile)
private void triggerAlarm(String title)
BitmapFactory.decodeFile(imageFile.getAbsolutePath());
private boolean checkTimeInPast(Calendar timeToCheck)

EventApplication:

This class is derived class from Application.
It has no members and only one function.
OnCreate() is the common function in every activity as explained above.
The other function is:

public static void cancelNotification(Context ctx, int notifyId)

The function is taking two arguments one of Context type and other one is integer type.
This function is responsible for the cancelling the notification.

HomeRecyclerAdapter:

This class implements the functionality of OnClick listener.
It has members of type Context, and type List
Functions:

getItemViewType(int)
getItemCount()
onBindViewHolder()
onClick()
OnItemClickListener()
configurePostView()
Inside this function we have implemented this logic
if (imageFile != null) { imageFile.getDataInBackground(new GetDataCallback() {
@Override
public void done(byte[] data, ParseException e) { if (e == null) {
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0,
data.length);
listingHolder.imageViewEvent.setImageBitmap(bmp); } else {
                e.printStackTrace();
            }

We are basically setting our required image of type bmp to listingHolder.
ListingHolder is a further class implemented in this activity.
In this class two members are used for user post info

public TextView txtTitle;
public TextView txtDate;

LoginActivity:

LoginActivity class extends AppCompatActivity.
A variable named REQUEST_READ_CONTACTS is maintained and initialized by zero.
The authentication system of the application is maintained by this class.
A string of DUMMY_CREDENTIALS

Is also maintained which is removed after connecting to the real authentication system.
A button is created with name mEmailSignInButton which is of button type.
This is the sign in button in the applicataion.

Functions in this class used are:

private void attemptLogin()

This function is responsible for singing in the user into the system. A string of email and password is maintained, then we apply multiple checks on these fields entered by the user.

Maintain Checks:

On first the system checks if the string is empty or password is empty, It will reply with the message the password or email address is too short.
Second check is for email address validity

else if (!isEmailValid(email)) { mEmailView.setError(getString(R.string.error_invalid_email)); focusView = mEmailView;
cancel = true;

If email address is not valid error message of invalid email is sent.
And if there is no error in checking email and password validity the following code is executed

else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
showProgress(true); loginUser(email, password);

The function loginUser(email, password) is used to login the user into the system.

void alertDisplayer(String title, String message)function displays the responses on the screen.
private boolean isEmailValid(String email) private boolean isPasswordValid(String password) private void showProgress(final boolean show) public void btnGtoSignupClick(View view)

MainActivity :

This class is inherited by AppCompatActivity.
This class is the started point of the program/application.
So it has OnCreate()

Members:

public static int MY_PERMISSIONS_REQUEST_READ_CONTACTS = 1001; List<ParseObject> shceduleEventsList;
HomeRecyclerAdapter adapter;
LinearLayoutManager mLinearLayoutManager;
TextView txtNoEvents;

OnCreate Method:

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
if (ParseUser.getCurrentUser() == null) {
finish();
Intent intent = new Intent(MainActivity.this, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);
}

Other Methods:

private void hideProgressBar() { progressBar.setVisibility(View.GONE);
}
private void showProgressBar() { progressBar.setVisibility(View.VISIBLE);
}
private void hideNoEventsText() { textViewEventsText.setVisibility(View.GONE);
}
private void showNoEventsText() { textViewEventsText.setVisibility(View.VISIBLE);
}
private void checkForPermission()
public boolean onOptionsItemSelected(MenuItem item) public void btnAddEvent(View view)

Activity NotifyButtonReceiver:

It is inherited by BroadcastReceiver and has one method named OnReceive()

public class NotifyButtonReceiver extends BroadcastReceiver { @Override
public void onReceive(Context context, Intent intent) { EventApplication.cancelNotification(context,NOTIFICATION_ID);
} }

RegisterActivity:

Extends by AppCompatActivity, It has variable initiated by zero.

private static final int REQUEST_READ_CONTACTS = 0;

Members:

private AutoCompleteTextView mEmailView; 
private EditText mPasswordView;
private EditText mPhone; 
private View mProgressView; 
private View mLoginFormView;

OnCreate Method:

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register);
// Set up the login form.
if (ParseUser.getCurrentUser() != null) {
Intent intent = new Intent(RegisterActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);
}

mEmailView = (AutoCompleteTextView) findViewById(R.id.email); mPhone = (EditText) findViewById(R.id.phone);
mPasswordView = (EditText) findViewById(R.id.password); mPasswordView.setOnEditorActionListener(new
TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
{
if (id == EditorInfo.IME_ACTION_DONE || id == EditorInfo.IME_NULL)
            attemptSignUp();
return true; }
return false; }
});
Button mSignInButton = findViewById(R.id.sign_in_button);
mSignInButton.setOnClickListener(new OnClickListener() { @Override
public void onClick(View view) { finish();
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
        }
});
Button mEmailSignInButton = findViewById(R.id.email_sign_up_button); mEmailSignInButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) { attemptSignUp();
} });
mLoginFormView = findViewById(R.id.login_form);
mProgressView = findViewById(R.id.login_progress); }
Other Methods:
private void attemptSignUp()
void registerUser(final String username, final String phone, final String
password)
void alertDisplayer(String title, String message) private boolean isEmailValid(String email) private boolean isPasswordValid(String password) private void showProgress(final boolean show)

Application Screenshots:

These Screenshots are from the UI of the application and also shows the functionalities available in the application. Below are the screenshots of signup page and sign in page.

img

The screenshot below shows the user entering credentials and next image shows the main page where all the events with their images, time and date are shown. These events could be from other users as well.

img

The following images show the user entering new events to the events page. User can add picture, time, date and details about the event.

img

img

img

Results and Discussion:

Event scheduling is the activity of finding a suitable time for an event such as meeting, conference, trip, etc.
It is an important part of event planning that is usually carried out at its beginning stage.

In general, event scheduling must take into account what impact particular dates of the event could have on the success of the event.
When organizing a scientific conference, for example, organizers might take into account the knowledge in which periods classes are held at universities, since it is expected that many potential participants are university professors.

They should also try to check that no other similar conferences are held at the same time, because overlapping would make a problem for those participants who are interested in attending all conferences.

When it is well known who is expected to attend the event (e.g. in the case of a project meeting), organizers usually try to synchronize the time of the event with planned schedules of all participants.

This is a difficult task when there are many participants or when the participants are located at distant places.

In such cases, the organizers should first define a set of suggested dates and address a query about suitable dates to potential participants.
After response is obtained from all participants, the event time suitable for most of participants is selected.
This procedure can be alleviated by internet tools and applications.

This application is focused to make event handling easy and efficient. People (users of the application) share their events.
Anyone who is registered with the email address can log in and see the events on the main page.

These events are added by the user itself or other users. The first page is Sign up page, when you start the application. User creates an account with his name, email address, and password.

Once the user is logged in using his/her email and password, it is directed to the feed page, where events are mentioned. If there is an event which is not yet finished then the user also gets the notification about the unfinished event.

File handling in this project:

On top of this hierarchy is the project folder, which provides the workspace for an application.
Automatic debugging in Android Studio will provide real time updates on errors that appear in the application and drill into the structure further to point out a specific resource containing errors.
Those will be marked with a red X icon.

  • src folder contains classes and packages. This is where the AndroidManifest.xml file will reference them from.
  • gen folder stores automatically generated identification data about all views and widgets, which provide information that can be seen on the screen. The content of this folder should not be manually changed.
  • Android folder contains the data about the Target Android library being used for the app.
  • assets folder stores any additional data that an app is using.
  • bin folder contains the data created after debugging, like project .apk file that gets installed on an actual device and information about resources used.
  • res folder stores different app resources. Most commonly, this folder is used to reference XML layouts from the “layout” sub-folder or different images for icons.

AndroidManifest.xml file is the most important file in the Android app file structure. Felker (2011) states that the file “keeps track of everything your application needs, requests and has to use to run.”

Some of its functions include providing information about available activities, services, and permissions used, or Android API level requirements.

The Async classes are implemented on the basis of following block diagram.

img

The authentication can also be authenticated using the social media platforms, it is not included in the application but it is a common practice these days to authenticate using facebook or twitter login.

Conclusion

This report is based on the android application for event scheduling.
The report is structured and the application is explained in its usage capacity and development capacity.

Introduction specifies the purpose of the application and why’s of the application.
Further the tools are explained for the development.
Literature review shows the applications of the same type and difference between them and this application.

Methodologies include the major part of the report where the technical approach is observed.
The code is explained whose explanation was required i.e the functionality code and structure.

This application will make the users happy because it will act as a personalized program to handle the events. The teams can be organized on the go by using this application.

AUTHOR

READ NEXT

Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?