4BD20CS014,4BD20CS082
4BD20CS014,4BD20CS082
4BD20CS014,4BD20CS082
ANOOP M 4BD20CS014
SAGAR K R 4BD20CS082
PROJECT GUIDES:
2022-23
Department of Computer Science and Engineering.
Bapuji Institute of Engineering & Technology
Davangere- 577004
Bapuji Institute of Engineering and Technology Davangere-577004
CERTIFICATE
This is to certify that ANOOP M, SAGAR K R bearing USN 4BD20CS014, 4BD20CS082
respectively of Computer Science and Engineering department have satisfactorily submitted the
mini project report entitled “ONLINE FARMER SHOPPING APPLICATION”. The report of the
project has been approved as it satisfies the academic requirements in respect of project work
prescribed for the academic year 2022-23.
Head of Department
Place: Davangere
(1)
(2)
ACKNOWLEDGEMENT
We express our sincere thanks to our guide Dr. SANTOSH K C & Prof. RADHIKA PATIL for
giving us constant encouragement, support and valuable guidance throughout the course of the
project without whose stable guidance this project would not have been achieved.
We express whole hearted gratitude to Dr. NIRMALA C R who is our respectable HOD of
Computer Science & Engineering Department. We wish to acknowledge her help who made our task
easy by providing with her valuable help and encouragement.
We also express our whole hearted gratitude to our principal, Dr. H B ARAVIND, for his moral
support and encouragement.
We would like to extend our gratitude to all our family members and friends especially for their
advice and moral support.
ANOOP M (4BD20CS014)
SAGAR K R (4BD20CS082)
Vision and Mission of the Institute
Vision
“To be a center of excellence recognized nationally internationally, in distinctive areas of
engineering education and research, based on a culture of innovation and invention.”
Mission
“BIET contributes to the growth and development of its students by imparting a broad based
engineering education and empowering them to be successful in their chosen field by inculcating in
them positive approach, leadership qualities and ethical values.”
3. Course Outcomes:
CO1 Create, test and debug Android application by setting up Android development
environment.
CO2 Implement adaptive, responsive user interfaces that work across a wide range of
devices.
CO3 Infer long running tasks and background work in Android applications.
CO4 Demonstrate methods in storing, sharing and retrieving data in Android
applications.
CO5 Infer the role of permissions and security for Android applications.
ABSTARCT
For several years, farmers in India have had little liberty in choosing markets and purchasers for their
produce. All states in the country, except three, degree that marketing and selling of farm produce must be
directed through state-owned mandis, retail markets where mediators (middlemen) crush farmers to increase
margins. According to research, mediators have become dominating buyers of the agricultural market,
resulting them to take control over the plight of the farmers and gulping all the profits. The farmers work day
and night expecting a good yield. They use a lot of financial resources lending money and buying fertilizers,
seeds etc. So, they have the right to enjoy every rupee gained on their corp. In this context, we propose a
system which brings farmers close to the retailers cutting the middlemen thus getting good profits for their
crops.
CONTENTS
TOPIC PAGE NO
CHAPTER 1: INTRODUCTION 1-14
1.1 Introduction to Android Studio 1-8
1.1.1 Architecture of Android 2
1.1.2 Installing and Running Applications on Android Studio 6-8
1.1.2.1 System Requirements 7
1.1.2.2 Setup Android Studio 7
1.1.2.3 Create Android Virtual Device 8
FIGURES PAGE NO
Fig 1 : Android Architecture 3
Fig 3: Flow Chart 24-25
3.1 User Login 24
3.2 Admin Login 25
Fig 5.1: User Registration Page 35
Fig 5.2: User login Page 35
Fig 5.3: Admin home Page 36
Fig 5.4: Adding new Food Items 36
Fig 5.5: User Dashboard 37
Fig 5.6: Food Items 37
Fig 5.7: User Orders 38
Fig 5.8: Cart 38
ONLINE FARMER SHOPPING APPLICATION
CHAPTER 1
INTRODUCTION
Android Studio uses an Instant Push feature to push code and resource changes to a running
application. A code editor assists the developer with writing code and offering code completion,
refraction, and analysis. Applications built in Android Studio are then compiled into the APK format
for submission to the Google Play Store.
The software was first announced at Google I/O in May 2013, and the first stable build was released
in December 2014. Android Studio is available for Mac, Windows, and Linux desktop platforms. It
replaced Eclipse Android Development Tools (ADT) as the primary IDE for Android application
development. Android Studio and the Software Development Kit can bedownloaded directly from
Google.
• Applications
• Application Framework
• Android Runtime
• Platform Libraries
• Linux Kernel
Pictorial representation of android architecture with several main components and their
sub components –
Applications –
Applications is the top layer of android architecture. The pre-installed applications like home,
contacts, camera, gallery etc.. and third party applications downloaded from the playstore
like chat applications, games etc. will be installed on this layer only. It runs
within the Android run time with the help of the classes and services provided by the
application framework.
Application framework –
Application Framework provides several important classes which are used to create an
Android application. It provides a generic abstraction for hardware access and also helps in
managing the user interface with application resources. Generally, it provides the services
with the help of which we can create a particular class and make that class helpful for the
Applications creation.
It includes different types of services activity manager, notification manager, view system,
package manager etc. which are helpful for the development of our application according to
the prerequisite.
Application runtime –
Android Runtime environment is one of the most important part of Android. It contains
components like core libraries and the Dalvik virtual machine(DVM). Mainly, it provides
the base for the application framework and powers our application with the help of the core
libraries.
Like Java Virtual Machine (JVM), Dalvik Virtual Machine (DVM) is a register-based virtual
machine and specially designed and optimized for android to ensure that a device can run
multiple instances efficiently. It depends on the layer Linux kernel for threading and low-
level memory management. The core libraries enable us to implement android applications
using the standard JAVA or Kotlin programming languages.
Platform libraries –
The Platform Libraries includes various C/C++ core libraries and Java based libraries such
as Media, Graphics, Surface Manager, OpenGL etc. to provide a support for android
development.
• Media library provides support to play and record an audio and video formats.
• Web-Kit This open source web browser engine provides all the functionality to
display web content and to simplify page loading.
Linux Kernel –
Linux Kernel is heart of the android architecture. It manages all the available drivers such as
display drivers, camera drivers, Bluetooth drivers, audio drivers, memory drivers, etc. which
are required during the runtime.
The Linux Kernel will provide an abstraction layer between the device hardware and the
other components of android architecture. It is responsible for management of memory,
power, devices etc.
system.
• Memory Management: It efficiently handles the memory management thereby
2. Set up Android Virtual Device (AVD): Android Studio comes with an emulator
called the Android Virtual Device (AVD) that allows you to test your applications on
virtual devices. Launch Android Studio and open the "AVD Manager" by clicking on
the AVD Manager icon in the toolbar or going to "Tools" -> "AVD Manager" in the
menu bar.
3. Create a new Android project: After setting up the AVD, you can create a new
Android project. Go to "File" -> "New" -> "New Project" in the menu bar. Follow
the steps in the New Project wizard to configure your project, including selecting
the project template, choosing the minimum SDK version, and configuring the
activity.
4. Build and run the application: Once your project is set up, you can build and run your
application on the virtual device. Click on the "Run" button in the toolbar, or go to
"Run" >"Run 'app'" in the menu bar. Select the virtual device you created in the AVD
Manager, and Android Studio will compile your code and launch the application on
the virtual device.
Department CS&E BIET, Davanagere 6
ONLINE FARMER SHOPPING APPLICATION
• CPU: 2nd generation Intel CPU (Sandy Bridge) or newer, AMD CPU.
• Memory: 8 GB RAM
• Free storage: 8 GB
a. In the SDK Platforms tab, select the Android versions you want to target with your
app. It's recommended to choose the latest stable version as well as the minimum
version you want to support.
b. In the SDK Tools tab, select the components you need, such as the Android Emulator,
Android SDK Build-Tools, and others. Again, it's recommended to use the latest
stable versions.
c. Click "Apply" to start downloading and installing the selected SDK components.
2. Open AVD Manager: Once Android Studio is open, click on the "AVD Manager"
icon in the toolbar. The icon looks like a smartphone with an Android logo.
3. Create a new virtual device: In the AVD Manager window, click on the "Create
Virtual Device" button.
4. Select a device definition: You will be presented with a list of device types and
configurations. Choose the device type that you want to emulate by selecting the
desired category and then clicking on the "Next" button.
5. Select a system image: On the "System Image" tab, select the desired system image
for the Android version you want to emulate. You can choose from various versions
and API levels. Click on the "Next" button.
6. Configure the virtual device: Give your virtual device a name, and optionally, choose
a skin and specify the device's hardware profile. You can also customize additional
settings such as RAM size, internal storage, and camera emulation. Click on the
"Finish" button when you're done.
7. Edit virtual device settings (optional): If you need to modify the settings of an existing
virtual device, go back to the AVD Manager, select the virtual device, and click on
the "Edit" button. From there, you can make changes to the virtual device's
configuration.
8. Start the virtual device: Once you have created or configured a virtual device, you
can start it by clicking on the green triangle play button next to the virtual device's
name in the AVD Manager. The emulator will launch and the virtual device will start
booting.
9. Wait for the virtual device to start: The virtual device may take some time to star
up, especially the first time. It will go through the Android boot process and
eventually reach the home screen.
10. Use the virtual device for testing: Once the virtual device is running, you can use it
for testing and running your Android applications. You can deploy and run your app
on the virtual device from within Android Studio.
1.3 HISTORY
Android is simply known as the official integrated development environment (IDE) for
Google’s Android operating system. It was built by JetBrains' IntelliJ IDEA and was mainly
designed for Android development. You can also choose to download it through Windows,
Mac OS, and even Linux-based operating systems that you may be using.It’s also important
to have in mind that this is simply a newer version of the Eclipse Android Development
Tools which was the initial IDE for Android application development.
Android Studio was first released at a Google I/O conference in 2013, on March 16. Later,
in May 2013, it was in the preview phase, or version 0.1. From here, it went into the beta
phase in 2014 of version 0.8.
The first stable version of Android Studio was created in December 2014. It is also known
as version 1.0.Another factor worth knowing is that on May 7, 2019, Java, the most endorsed
programming language for Android app development, was replaced by Kotlin. Java is still
available and supported in C++.
Android Version Evolution
Since the development of the first cell phone in 2008, Android has always made updates and
developed new operating systems that are up to date. There are 12 versions of the operating
system installed in more than 3 billion devices around the world.
In the beginning, Android versions were named after some sweet treats and even desserts,
with their initial letters following the order of the alphabet. Starting with Android 10, this
changed and only simple numbers were used as names.Now, let's take a closer look at the
long list of Android versions and explore how they have evolved over time.
• Video recording
• Search widget
• Customizable home screen
• Third-party app framework
that was faster and simpler.It was also equipped with NFC technology and offered the
possibility of voice and video chats via Google Talk. It also allowed the use of multiple
cameras, which led to the introduction of the selfie camera.
6. Android 3.0 – Honeycomb
Honeycomb boasts of being the very first Android operating system designed mainly for
large mobile devices like tablets. This version brought a nice user interface with a new action
bar and also supported multitasking. Unfortunately, this is also one of the versions that were
not very welcome on the market.
7. Android 4.0 – Ice-cream Sandwich
This version was introduced in October 2011. It came along with updates on the user
interface, especially the introduction of the new font “Robot”, soft buttons inherited from
Honeycomb and a built-in photo editor. This OS version also allowed users to unlock their
phones with biometric features, such as the face, since it supported the facial recognition
feature. The final improvement that came with this operating system was the ability to set
limits on data usage. You could monitor your data usage.
8. Android 4.1 – 4.3 Jelly Bean
The OS version Jelly Bean that was launched in July 2012 not only improved the user
interface but also increased the performance. Other improvements that came with this
operating system version were the ability to interact with notifications in different ways and
even expand the notification buttons. This feature allowed users to turn on and off all types
of notifications in an application depending on their preferences.
9. Android 4.4 – KitKat
This version of Android OS was named after the famous KitKat sweets and was released
back in September 2013. It introduced many pillar improvements and functions. The first
and most important is its capability of being able to run on smartphones having 512 MB of
RAM. This made several devices able to update to this version.KitKat also boasted of having
white elements instead of blue ones. Lastly, it was also the first-ever version to have the
“Ok, Google” voice command service.
Announced in May 2015, the Marshmallow version was then officially released in October
of the same year. This version came with the native fingerprint reader, USB - C and also
Android Pay, which is since then known as Google Pay.
Android 7.0 – Nougat introduced the split-screen feature that allows users to run two apps
simultaneously .Besides this amazing feature, this version also introduced a customizable
pull-down menu, then the fingerprint gesture to swipe down and also added some other
emojis. Another improvement that was not easily noticed was the support for the Vulkan API
an approach influencing future updates.
Released in July 2017, Android 8.0 Oreo OS brought major changes to the visual menu.N
However, the most important change was the introduction of Project Treble, which is a
modular architecture designed to help hardware vendors keep up with evolving Android
versions in a simple and fast way.
It is still the most popular OS version. A new home button has also been introduced, leading
to an extended navigation button at the bottom of the screen. Besides the performance boost,
battery optimization, and other security improvements, this version
also introduced the Shush function, which puts the phone into Do Not Disturb mode
whenyou flip the screen down.
15. Android 10
This is the very first Android OS version that has dropped all iconic names related to sweet
treats that were seen in previous versions. This might have resulted in the lack of sweet
names or a change in marketing strategy.This version in 2019 brought tons of security
updates and a large amount of support for APIs and also support for the foldable phones that
were supposed to be introduced at that time.
16. Android 11
A year after the release of Android 10, Google introduced Android 11, which offered several
options to manage notifications and also controlled upgrades to monitor smart home devices
as we embrace the Internet of Things in our lives. Finally, this OS version also introduced
the screen recording feature and chat bubbles.
17. Android 12
At the time of this article's publication, the latest Android operating system is available in
Android 12, which was released in October 2021.
According to information from the Android Developers Blog, this operating system offers
the best user experience, improved energy efficiency, and easier Wi-Fi sharing, among other
improvements.
18. Android 13
A few days ago, the first announcement about Android 13 was published. Not much is known
yet, but exciting new features are in store. The fact that it will be possible to run Windows
on a virtual machine on Android 13 in the new Android version is discussed quite intensely.
As Android developer Danny Lin (aka kdrag0n) has shown on Twitter.
1.4 OBJECTIVES :
Online farmer shopping application is to provide a platform for farmers to sell their products
directly to consumers in this context, we propose a system which brings farmers close to the
retailers cutting the middlemen. This application is created for the producers who havedecided
to go online in order to increase sales volume.
15
Department CS&E BIET, Davanagere
ONLINE FARMER SHOPPING APPLICATION
16
Department CS&E BIET, Davanagere
ONLINE FARMER SHOPPING APPLICATION
Licensed under Apache, Android is an open source operating system whose codes
developers can change to build customized User Interface. App developers building
applications for this platform can get access to the core codes and are at a liberty to change
the them to get the customized outcomes. This is not possible when it comes to iOS and app
have to strictly adhere to the core code specifications when developing apps for the specific
platform.
Since Android is a Google product, users having Gmail account can have access to
cloud storage that are supported by the tech company. This means that users can
sync devices using Google accounts. Moreover, Google gives 15GB of free cloud
storage to every user that is good for an average person using it for personal
purposes.
Android gives users the freedom to download 3rd party widgets and also display
their content on the home screen. If a user wishes to view time and temperature
17
Department CS&E BIET, Davanagere
ONLINE FARMER SHOPPING APPLICATION
shown by a specific widget on the home screen, it is possible with devices running
on the platform.
With Android running on a device with good hardware specification, as a user you
can have multiple apps running simultaneously. You can continue to listen to music
as you check your messages or download files that you’ve received or even upload
them from your device or drive. There are a lot of Android app development
companies who build applications based on Android that are very useful in our daily
lives.
One of the biggest advantages of using devices running on Android platform is that
it supports expandable memory. iOS devices on the other hand do not support
external memory expansion by adding memory card to the phone. Users of this
platform enjoy the privilege of storing e-books, music, videos and games on their
devices.
Android users are spoilt for choice of smartphone devices of different prices. There
is something for people across all budget spectrum when it comes to smartphones
running on Android. Almost all companies build devices that support Android
platform giving users multiple options when buying. This is something that is very
restrictive for Apple users who have to stick to the company’s expensive devices
only.
CHAPTER 2
REQUIREMENT SPECIFICATION
1. User Registration: The app should allow users to create an account by providing their
basic information such as name, email, contact details, password.
2. User Login : Registered users should be able to login by using the registered info.
3. User dashboard : Users should be able to search for the food items they want to buy from
the farmers, they’ll also get the checkout page where they can verify their cart and proceed
further to purchase, also they’ll get the order page where they can check the orders placed ,
there is also a feedback page where they can give their opinion on their shopping experience
and finally they’ll get the profile page where they can see their personal details.
4. Admin dashboard: The app should provide a admin dashboard where the administrator
can list the crops received by the farmers, can also delete the items if they go out of stock, can
also check out the orders placed by the users, and also get to view the feedbacks givenby
the users from which administrators can improve the user shopping experience.
1. Usability: The app should have an intuitive and user-friendly interface, with clear
navigation and well-organized features. It should be easy to learn and use for individuals with
varying levels of technological proficiency.
2. Performance: The app should provide a responsive and smooth user experience, with
minimal loading times and delays. It should handle user interactions efficiently, even under
peak usage scenarios, ensuring a seamless and uninterrupted operation.
3.Reliability: The app should be stable and dependable, with a high level of availability.
It should minimize system crashes, errors, and unexpected downtime, ensuring users can rely
on it for critical blood donation needs.
4. Scalability: The app should be designed to accommodate future growth and increasing user
demands. It should be scalable to handle a growing user base and additional features without
sacrificing performance.
5. Security: The app should employ robust security measures to protect user data and ensure
privacy. It should implement encryption protocols, secure authentication mechanisms, and
prevent unauthorized access to sensitive user information.
6. Compatibility: The app should be compatible with a wide range of Android devices,
including different screen sizes, resolutions, and operating system versions. It should be
optimized for various device configurations to ensure consistent performance.
CHAPTER 3
DESIGN
3.1 INITIAIZATION
• Project Planning: Start by defining the project scope, goals, and requirements of the
Farmer shopping application. Identify key stakeholders and establish a project timeline.
Determine the target audience and the specific features and functionalitiesthe app
should include.
• Team Formation: Assemble a team of developers, designers, and testers with expertise
in Android app development. Assign roles and responsibilities to team members based
on their skills and experience.
• Technology Stack: Choose the appropriate technology stack for developing an Android
app, including programming languages like Java or Kotlin, Android Studio as the
development environment, and any necessary frameworks or libraries.
• Data Architecture: Plan the data architecture for the app, including the database
structure, data models, and data storage options. Determine whether to use a local
database or a server-side database for storing user information, donation requests, and
other relevant data.
• User Interface Design: Begin the process of designing the user interface (UI) and user
experience (UX) of the app. Create wireframes and mockups to visualize the layout,
navigation flow, and screen designs. Ensure the UI is intuitive, visually appealing, and
aligned with the app's goals.
3.2. DESIGN
• User Registration and Login: Design screens and workflows for user registration and
login processes. Include fields for users to provide their basic information, such as name,
contact details. Ensure the login process is secure, with appropri+ate authentication
mechanisms.
• Finding food items: Create screens for users to find the food items he/she wants to buy.
Allow users to specify the quantity of the food items they want to buy. Implement
notifications to alert the users when a order is placed.
• Feedback section: Design screens that enable users to provide their feedback on the
buying experience where they can mention the problems they faced while shopping and
they can give their point of view about how it can be made better.
• Listing and deleting the food items : In the administrator side screens that enable admins
to list the food items they receive from the farmers and also to delete the food items
when they go out of stock.
• Viewing the user feedbacks: Design screens in the admin section where the admins can
view the user feedbacks and make improvements according to the feedbacks givenby
the users.
Start
Login
no
Already
a user Register
yes
User Dashboard
Checkout
Give Feedback
Log out
Stop
Start
Login
Already no Register
a user
yes
Upload Food
Delete Food
Order
Feedback
Logout
Stop
CHAPTER 4
IMPLEMENTATION
4.1 OVERVIEW
In this project we exhibit overview of Online Farmer Shopping Application. We have taken
the help of Android Studio (Electric Eel) which brought all the codes together to create app. It
will also handle AI and physicsroutines.
4.2 CODE:
4.2.1 REGISTER:
package com.example.agrishop;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.firestore.FirebaseFirestore;
public class Register_Page extends AppCompatActivity {
EditText mFullName,mEmail,mPassword,mPhone,address;
Button mRegisterBtn;
TextView mLoginBtn;
FirebaseAuth fAuth;
FirebaseFirestore fStore;
FirebaseDatabase database;
FirebaseFirestore fstore;
String userID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_page);
mFullName = findViewById(R.id.name);
mEmail = findViewById(R.id.email);
mPassword = findViewById(R.id.password);
mPhone = findViewById(R.id.phone);
address=findViewById(R.id.address);
mRegisterBtn=findViewById(R.id.register);
mLoginBtn = findViewById(R.id.login);
database=FirebaseDatabase.getInstance();
fstore=FirebaseFirestore.getInstance();
fAuth=FirebaseAuth.getInstance();
fStore=FirebaseFirestore.getInstance();
mRegisterBtn.setOnClickListener(new View.OnClickListener ()
{
@Override
public void onClick(View v)
{
String email = mEmail.getText().toString().trim();
String password= mPassword.getText().toString().trim();
String name= mFullName.getText().toString().trim();
String phone= mPhone.getText().toString().trim();
String useraddress= address.getText().toString().trim();
if(TextUtils.isEmpty(email))
{
mEmail.setError("Email is Required.");
return;
}
if(TextUtils.isEmpty(password))
{
mPassword.setError("Password is Required.");
return;
}
if(password.length() < 6)
{
mPassword.setError("Password Must be >=6 Characters");
return;
}
fAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(
new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task)
{
if (task.isSuccessful()){
String uid =
task.getResult().getUser().getUid();
Usermodel users = new Usermodel
(email,password,name,phone,useraddress,uid,0);
database.getReference().child("Usersregister").child(uid).setValue(users);
Toast.makeText(Register_Page.this, "User
Created", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Register_Page.this,
Login_Page.class);
startActivity(intent);
finish();
}
}
}
});
mLoginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(),
Login_Page.class));
}
});
} num
4.2.2 LOGIN:
package com.example.agrishop;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class Login_Page extends AppCompatActivity {
EditText mEmail,mPassword;
Button mLoginBtn;
TextView mRegisterBtn;
FirebaseAuth fAuth;
FirebaseDatabase database;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_page);
mEmail = findViewById(R.id.email);
mPassword = findViewById(R.id.password);
mRegisterBtn = findViewById(R.id.register);
mLoginBtn = findViewById(R.id.login);
database=FirebaseDatabase.getInstance();
fAuth=FirebaseAuth.getInstance();
mLoginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String email = mEmail.getText().toString().trim();
String password= mPassword.getText().toString().trim();
if(TextUtils.isEmpty(email))
{
mEmail.setError("Email is Required.");
return;
}
if(TextUtils.isEmpty(password))
{
mPassword.setError("Password is Required.");
return;
}
if(password.length() < 6)
{
mPassword.setError("Password Must be >=6 Characters");
return;
Department CS&E BIET, Davangere 28
ONLINE FARMER SHOPPING APPLICATION
}
fAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task)
{
if (task.isSuccessful()){
String uid=task.getResult().getUser().getUid();
database.getReference().child("Usersregister").child(uid).child("usertype")
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
publicvoidonDataChange(@NonNullDataSnapshotsnapshot) {
intusertype=snapshot.getValue(Integer.class);
if (usertype == 0){
Intentintent=newIntent(Login_Page.this, User_Dashboard.class);
startActivity(intent);
finish();
}
if (usertype == 1){
Intentintent=newIntent(Login_Page.this, Admin_Dashboard.class);
startActivity(intent);
finish();
}
}
@Override
publicvoidonCancelled(@NonNullDatabaseErrorerror) {
}
});
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(Login_Page.this, "Failed",
Toast.LENGTH_SHORT).show();
}
});
}
});
mRegisterBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(),
Register_Page.class);
startActivity(intent);
}
})
return;
}
fAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task)
{
if (task.isSuccessful()){
String uid=task.getResult().getUser().getUid();
database.getReference().child("Usersregister").child(uid).child("usertype")
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
publicvoidDataChange(@NonNullDataSnapshotsnapshot) {
int
usertype=snapshot.getValue(Integer.class);
if (usertype == 0){
Intent
intent=newIntent(Login_Page.this, User_Dashboard.class);
startActivity(intent);
finish(); }
if (usertype == 1){
Intent
intent=newIntent(Login_Page.this, Admin_Dashboard.class);
startActivity(intent);
finish();}
}
@Override
publicvoidonCancelled(@NonNullDatabaseErrorerror) {
}
});
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(Login_Page.this, "Failed",
Toast.LENGTH_SHORT).show();
}
}) }
});
mRegisterBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// redirect to RegisterActivity
Intent intent = new Intent(getApplicationContext(),
Register_Page.class);
startActivity(intent);
}
});
}
}
package com.example.agrishop;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.google.firebase.auth.FirebaseAuth;
public class User_Dashboard extends AppCompatActivity {
CardView food,mycart,myorder,profile,logout,feed;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_dashboard);
food=findViewById(R.id.food);
mycart=findViewById(R.id.mycart);
myorder=findViewById(R.id.myorder);
profile=findViewById(R.id.profile);
logout=findViewById(R.id.userlogout);
feed=findViewById(R.id.ufeedback);
feed.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(User_Dashboard.this,User_Feedback.class);
startActivity(intent);
}
});
logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FirebaseAuth.getInstance().signOut();
Intent intent = new Intent(User_Dashboard.this, Login_Page.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
});
profile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(User_Dashboard.this,Profile.class);
startActivity(intent);
}
});
myorder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Department CS&E BIET, Davangere 32
ONLINE FARMER SHOPPING APPLICATION
CHAPTER 5
TESTING
The following testing approaches were employed during the testing phase:
Unit Testing: Unit testing was performed to validate individual components and modules
of the app. This involved testing each unit in isolation to ensure theyfunctioned correctly.
Key functionalities, such as user registration, login, and blood donation requests, were
thoroughly tested to ensure they operated as expected.
System Testing: System testing was performed to evaluate the app as a whole, ensuring that
all components work together harmoniously. The entire flow of the app, from user
registration to blood donation requests and notifications, was tested to validate its
functionality and usability. Scenarios such as handling networkinterruptions, error handling,
and edge cases were considered during this phase.
Usability Testing: Usability testing was conducted to gauge the app's user- friendliness and
intuitiveness. A group of representative users were invited to perform specific tasks and
provide feedback. The feedback was used to improve the app's user interface, navigation,
and overall user experience.
Compatibility Testing: Compatibility testing was carried out to ensure the appfunctions
correctly across different Android devices, screen sizes, and operatingsystem versions. The
app was tested on various devices, including smartphones and tablets, running different
versions of Android to identify any compatibility issues.
Performance Testing: Performance testing aimed to assess the app's responsiveness, stability,
and resource usage under different scenarios. Load testing was performed todetermine the app's
behavior when multiple users simultaneously access the app and perform various activities.
Performance benchmaeks were established to measure response time and resource
consumptionenchmarks were established to measure response times andresource consumption.
CHAPTER 6
SNAPSHOTS
6.8 CART
CONCLUSION
Security and privacy are of utmost importance in a shopping application. With robust
authentication mechanisms, encryption protocols, and compliance with data protection
regulations, users can trust that their personal information and payment info are kept
confidential and protected.
REFERENCES
BOOKS:
• Google Developer Training, "Android Developer Fundamentals Course –
ConceptReference”, Google Developer Training Team, 2017.
• Erik Hellman, “Android Programming – Pushing the Limits”, 1st Edition, Wiley
IndiaPvt Ltd, 2014. ISBN-13: 978-8126547197
• Dawn Griffiths and David Griffiths, “Head First Android Development”, 1st
Edition,O’Reilly SPD Publishers, 2015. ISBN-13: 978-9352131341
• Bill Phillips, Chris Stewart and Kristin Marsicano, “Android Programming: The
BigNerd Ranch Guide”, 3rd Edition, Big Nerd Ranch Guides, 2017. ISBN-13:
978- 0134706054
REFERENCES:
• https://www.gitbook.com/book/google-developer-training/android-
developer-fundamentals-
• https://cloud.smartdraw.com/editor.aspx?templateId=490dad73-de30-42bf-
9a58-1789d56c1afd&flags=128#depoId=36058085&credID=-39639645