Transcript for:
Android Beginner Project with Database Connectivity & Layout Design

hey learner this is Nilesh borate from Village technology so in this video I am going to show you the step by step the Android beginner project with database connectivity attractive layout design Etc so first go through the project what we are doing in this video so now I have created a one blank project okay so let me show you how to create this blank project so go to the file new new project select here the empty Activity Click on next give your the application name this is your the package name okay save location says choose your the drive where you want to save this project so programming language is Java minimum SDK version is the API 21 Android 5.0 then click on next or finish okay so after finish okay so so this so these two files are created uh Main activity.java and this is one layout file and this is your the project structure okay then I have created a one emulator on right hand side so see here how to create in in tool there is one option avd manager so click on that avd manager see here I already created a one uh emulator so if you want to create a new then click on this button create virtual device okay and choose your uh device name so I have selected the pixel 2 and my screen size is 5.0 this is the resolution density click on next and this is the different versions different release of Androids so here I have selected Android version or API level 30 Android 11.0 Okay click on next then choose your theory name and click on finish okay so then this kind of uh avd is created on your machine okay so after creating the avd and creating a one empty project so just right click on this uh in this activity or go to this toolbar so see here in that toolbar there is one button run app now I'm just I'm just stop this stop this uh running activity okay so click on this run button and one more thing is that in that drop down choose your the emulator name so this pixel 5 API 30 is our recently created the emulator so this is our emulator and click on that run button so after taking some time that activity or that project is executed on this emulator so this shows the hello world name so let me explore this project structure so in that res in that layout this is the Android Main XML file and in that Java in this package com.example.healthcare mainactivity this is the main activity.java file and this activity main.xml is your the layout file so in this tab there are three sections code section split section design section so in this code section by default layout is that the constraint layout and this is a very good layout for if you want to design the page using drag and drop functionality okay so we are also we use the same layout to drag and drop because instead of this writing the code uh we get uh we save a lot of our time if we are using a drag and drop design layout activity right so this is the default layout and this is the one text View and in that text to the text is that the hello world so see in design section the hello world is displayed in the center of this page or the activity so that's why that message is displayed in this email data right so I want the some background images some some icons some layouts so for that I am just copying the some material readymade material in this drawable folder okay and I have also shared that material Link in the description of this video so download all the material of that project okay so I am just copying all this thing here together yeah so see uh this is the one background image this is another image third image uh these are the some icons calendar icon then this is the one setting icon this is chart icon okay then these are the some images okay then uh this is the one background uh round uh round circular shape and we have to use that shape in a input field okay so these are the some or some material we have directly copy paste in this drawable directory so you can also do it okay so I have closed all these things here okay fine so another thing is that now I have created a new activity uh which activity the login activity so our first page is that the login page so just right click on this package com.example.healthcare new and that activity create the empty activity so here let me give the name of that activity is the login activity and the layout name is that the activity underscore login Okay click on that finish so that login activity is created and that related layout is also created activity underscore login and that layout is linked in this on create functions here r dot layout dot activity login okay now I am going to design this activity login.xml page so first thing I am just uh add here um some some text view some buttons but before that I'm just going to set some background image here okay so there is one property just add here background Android background and drawable and use the back one okay check it in drawable directory back one is the one of the background image so that image we have to use here so save and going again the design section so that background image is applied to that activity okay then in that text just use the one text View here okay then use one more text for login then use the input field uh like username field so I'm just track this edit text then our password I use this field then I need a one button login button here and if the user is a new user then use the one text view here okay now I am just say to some some font size and other things okay so in this there are some attribute section also also not required to go to the every time in code and set some property we have two options so set the property using this this attribute section also or the code section also so in that text View uh in the text yeah so I'm just passing here the 24 by 7 Healthcare this is my application name okay yeah then I'm just set a text size yeah set the text size is that near about 34 34 okay and set text style as a bold text idea bold yeah click on that bold button yes yes right okay so then set some colors okay one more thing is that we have one XML file colors.xml so see here uh in in res directory weight in not Aries in values directory there is one XML file colors.xml so these are the some color codes uh purple 200 500 700 then these are the and these are the some sample of this color uh if you want to set some more colors in your projects so use some color code and give your the name of that color so I am just use that color code okay this is the one the primary dark color this is the black color white color uh color red okay something is the different shade of that red color then dark yellow light so that is the color code okay and we set more colors in that file so save that colors.xml and use that some colors in our uh in our activity okay so I'm just going to set the color the purple color okay so just text color here uh purple 200 okay okay so that color is set here okay so looking good then another one is that the login login button this is the another text view this one so in that text view again the text is that the login text then the text size is also 34. uh style is also bold uh and the color is here we set the color is that white text color is going to set the color is that the color white okay okay fine then this is the one text field name text field okay so in that uh in that actually this is the edit text property all right edit text this one edit text so first we set uh one background which background check in the drawable input VG this is the rounded circular shape so I so we just set that shape so check this is the code actually okay so we create a one shape and this is the one stroke and set of Corners the 70 DP pixel okay so here I'm just going to set a one background property so alphabetical wise order wise a b yeah background yeah set a background is that this one input BG okay input VG this is the the background okay check that uh that edit text set the the input background is that the rounded shape background okay now the another thing is that uh we set one more uh before that we set some some padding spaces left space top space some right space some bottom space okay so for that uh just going to the padding section yeah in that padding so just set the padding um padding left 20 DB add in top 10 DB okay then right on site on the right again 10 DP okay and bottom is also 10 DB yeah so we set some some padding spaces okay then set a color [Music] text color so text color again we set a white okay and uh name this is the text color hint actually we also set the same color white text color hint text color and text color hint okay then the padding spaces then input type so what is the input type so input type is that the this is the actually text just the uh basic name okay so we change the Heat hint so hint is that username and we remove the text actually not required the text here yeah okay username then we also one icon here on the left hand side we have icon of uh username icon this one person IC Baseline person okay so we set a drawable icon on left hand side left hand side icon okay so drawable lift and we use a this this icon person 24 okay so that icon is shown here yeah right then we set a drawable padding margin 10 DB just for the basic spacing in between icon and text okay okay now I'm just going to remove this field and copy this field one more time so before that I am just uh give the some extra space yeah okay so I'm going to copy Ctrl C Ctrl V okay yeah now change the hint and icon also the icon is that left icon is that the password icon this one IC Baseline security this is like the password icon and we change the hint password yeah okay then this is the button login button okay we set uh text is that the login text okay then yeah this is my login button we also set us some background yeah background is just the button BG rounded shape button yeah okay yes the last text view is the this is for just the message for the register for new user link okay let's get the message register for new user okay and we set a text color is that the white color text color is the color white okay and I think the size is okay yeah now another thing is that uh so check it in the code there are some errors actually on each and every uh component text view there is one red line underline right so uh so for that we need to set some some constraint uh constraint orientation for the Left Right top and the bottom okay so for that first this one is that the 24 by 7 right this is our the first uh first thing here so for that uh I'm just set the here so this activity for the right side this is for top and this is for bottom yeah so that's why this is shown in a Center of this screen okay then we just set here the this position okay then this is the login and just uh yeah for that login also let me just set a again yeah this is a under 24 by 7. okay then this is a username edit text again we set the orientation on left right and only top top for login yeah and we set the distance is yeah okay so same as password left right and this one okay then login button yeah okay and the last one okay so save all these changes I think uh yeah okay fine you check in the code section all the errors are in because of this constraint end start top these four lines is very important to set each and every component to others is that respective to other component is that from the end of this component from the start of this component like this way okay now here we set us some some ID so this is the default ID edit text person name two so I'm just add here the ID is that so hint name is there is in password okay so this is the password actually so edit text password okay I'm just giving the edit text login password because this is a login activity right then same as edit text login username the another edit text this one edit text login username yeah then need to set the sum yeah there is one more change actually yeah actually just just need to change this is the actually password of user name and this one is the login password yeah actually before the constraint setting first view first you have to set the all the IDS then set the constraint setting okay so avoid these kinds of errors also parallel check in design section all these designs are looking good yeah then we need also set one one button name okay so this is the login button so button login and check I think there is here here is a button login then registration this is the text View new user okay text view new user yeah then check uh actually this is just a text for login and text for the this is the healthcare title not required to set proper uh text view ID name because we are not going to use in a in a Java code for writing some some event or some actions right yeah so I that design is ready so let me just uh run this design so when we run again run the app check it again this this page hello world it's shown here why because the default activity is the main activity so we need to change the default activity as a login activity so again we are going to the Manifest Android manifest.xml file and here check here this is your the one of the activity register activity and you are the default activity name is that the main activity so we're required to change the default activity as a login activity so we just replace the name here as a as a login activity uh think uh if this is a login activity then then not uh required to register this activity actually so I'm just removing this section yeah right okay check it again rerun yeah looking good username yeah and password I think uh password text is invisible actually looking uh like that text set the star star right so for that that password that code section uh this is the password yeah input type is yeah here we we want to change the input type is that the password input type I'm just yeah text password control space for looking the sum drop down options okay then rerun for refreshing this emulator yeah username back password good this is login button this is register for new user redirecting to the new activity registration activity yeah this is the basic design and uh one more thing is that so we we need to remove this this uh this actually action bar this one Healthcare so for that in that theme section themes.xml so this is the style uh theme dot material component Dark Knight dot dark action bar so we we not required that action bar so I'm just uh going to here and control space for no action bar save that changes and rerun this activity okay looking good now there is no action bar here okay yeah so on next time I'm just copy paste that activity means that this login activity or to avoid the some some time actually save the some time because uh there are a lot of things are upcoming actually like the DB connectivity then some other layout design also and everything okay so okay yeah first here we set some objects we have to edit text username and password so edit text Ed username TD password uh we have one button uh we also need to set up some event uh when we click on this register for new user so register for new user is our text View so one is the text View control space text to so all these uh classes are imported here in in Android dot widget class okay yeah we're required to create a create a object in that oncreate function so that class object is internally mapped to this XML file with the help of function find view by ID okay so we are using that function here ad username equal to find view by ID r dot ID dot our edit text name is that the edit text login password and edit text login username so edit text login username same as copy paste four time for the Ed password then BTN button text View TV and here it text login password and this is the button actually login button button login and this is a text View text view new user right so all these objects are created then we set a sum event so first we set uh action event of button when we click on that login so BTN dot set on click listener this is the event of when we click on that button then that activity is executed so New View dot on click listener so this is a one Anonymous class on click listener this is a um event of means that on click is the event actually and that function is written inside this event inside this function actually set on click listener so when we click on that button that function is executed so for testing purpose I am just going to write here the one post message toast dot make text and the first object is the context context means that they get the current activity uh object so get application context so we get a current application context as a first parameter second is that the text so I'm just pass here the login success text and the third is that the duration how much time that message is displayed so message displayed there are total default or two durations long duration short duration and just use the short duration and the last one is that the show function okay so we just test that button activity that is that that is work or not so just rerun this application check it here login yeah login success this is the toast message okay good now uh we also required the basic validation like both fields are empty or not okay so for that first we get the username and password so string username equal to Ed username dot get text and also need to cast to the string same we get a password ad password get text and casting to the string now check here the some validation like username length is equal to equal to 0 or password length is equal to equal to 0. means if either username or password is in blank then inside this if just copy the One More post here and just change the message like please field all details okay otherwise else just remove this toast here right check it again username password yeah login success if anyone feel is blank oh sorry sorry let me just forget to rerun this application yeah check it again please fill all details again check please fill all details yeah login success okay so before writing the login functionality here first we need to make the registration page okay first we need to register some user then after that we make a functionality like the login functionality right so we are going to create a new activity the registered activity so right click on this package create a new activity empty activity activity name is that the register activity finish yeah this is the register activity and by default message is that the Hello message right so for that first week uh writing the functionality when we click on this register for new user then we we need to redirect to the new activity means that call to the another activity so for that for that here uh also need to write a on click event on that text View so same PV dot set on click listener new on click listener okay so when we click on this text view we need to call the new activity so for that we required a intent object and that intent is called as explicit intent okay there are there are two types of maintained implicit and explicit if you want to call uh user defined activity then that kind of intent is called as explicit intake okay so here I am just use a start activity function and inside this we need to create an intent object see here intake so new intent new intent the first parameter is the current activity so my current activity name is that the login activity so login activity dot class need to pass the class name and another one is that the callable activity so my jump activity is that the register activity dot class okay so this is the start activity I think there is some oh sorry this is not a class actually this is the this current activity yeah same check it again we just rerun this application when we click on this user redirected to the new activity actually I think this is my empty activity uh yeah empty activity so that's why I'm not showing any anything here but it's okay this is smoothly redirected to the new activity now I am just going to copy everything here in this login XML like all these things going to copy and paste it here this code section everything everything I just copied just change after some time we just change the all the IDS and other things also we change the background uh we set here the background so background is that just say to background we change the another background drawable background so going to the design section see here this is the 24x7 login right so just uh moving up all these things and change the login name to register registration or sorry this creation or register then username password is required then confirm password and email ID okay so for that for the temporary purpose and I just required two more edit text here right so for that I am just removing the login up constraint so this one click on delete I'm just removing the up and yeah also we're removing the up click the up button click on delete yeah why because after username here the another input text is that the email ID then password then confirm password okay so for that I'm just copy the username and paste it here yeah and this is the below of this one yeah this is the password is below of this field and the distance is 32 I'm just keep the all the distance same 28 um yeah here uh yeah top distance you set a 28 yeah here is also 28 just copy password one more time and set the up constant is this one this is also 28 and set yeah uh just need to some hint and the ID name right so going to the code thank you for that just change the hint name so username email and this one is that the confirm password yeah then we change the icon this drivable left icon so drawable left icon is the email and yeah the password both passwords so we we keep the same icon on password as well as confirm password okay going to the code section we say we need to set some IDs yeah so this is the text login password to means that is the confirm password okay so for that confirm password which is change this is not a login activity this is the register so rake confirm password Rick then input type is text password and everything is same this is the another one username for that username edit text rake username means that register user then use a edit text rake password list of the registration page yeah this is the login username two two means that uh email think uh confirm password edit text login not login Rick password email I think one more ready text is pending edit text login username yeah this is one username so where is email oh this is the email actually not a username email text Rick email okay foreign email uh yeah button login but we said button register register new user button register and in the design section uh yeah set the top is that the confirm password yeah now the code is error free the registration page is designed successfully okay I think uh one more thing is that we need to change the text here uh need to change the text is that the already have an account right already if there is already account then redirect to the login page right check it again already have an account so uh text View existing user looking good now we rerun this code check here yeah registration page again going to the I need to set some event on this page okay so for that registration also we need to set some edit text objects then button object and the text view object okay so we set some objects here edit text is the Ed username Ed email ID password Ed confirm one is the button and one is the text View text View TV okay and we just copy all these thing here yeah we change the edit text uh I think rig username is missing check it again username field yeah I need to change the rig username oh foreign this is the text view too right and reg email check it again the reg email reg username and this is the ring username yeah yeah so avoid this kind of error so first again set some all the IDS in the insect the all the constraints layout okay now looking good so here edit text array username edit text rig password we need one more one or two more section for the email and the confirm password email confirm Reddit text email uh confirm password and the button is the register button text view existing users yeah right so we also set a layout means that this event so we copy the same thing is here just need to change the current activity is the register activity dot this and the jump activity is the login activity yeah and button dot set on click listener new on click listener yeah okay so again we get a all the data from that edit text so we get a username text email text password text and confirm text we set all the text in in those variables and again first we check all these fields are empty or not so like login we use a one if condition okay so condition is that if the username length is 0 or email 0 password 0 or confirm 0 then shows the one pop-up message please fill all the details okay else if all fields are filled up then we need to check the password and confirm password both are saved right so here we check a password dot compare to confirm password if both passwords are same then okay but if not okay then show one error like password and confirm password didn't match length short show okay and if both passwords are same okay then we check uh the password is valid or not valid password means that we just need to check the password length is 8 then password having one letter one digit um then um alphabets like Etc so for that we just need to use a one built-in function so I am just copy this function here to check all these things are correct or not okay for not here after this after this oncreate function yeah here here so public static Boolean is valid so string pass here the one password so check the password length is less than ATP release then in return false then check it again the password uh having uh is later character than having a one digit okay then there is one one character in between uh these oscillators we set a three flags if all the flags are set then we return true means that password having the combination of one special character digit and one later and also minimum length is that it if everything is good then we return a true okay so we also need to call that function here info both passwords are same then we check the password is the valid password if the password is a valid password so if this password is not valid then shows I will show again a one one error message this one is the else yeah uh yes right the password is valid then okay the password must contain at least eight characters and special symbol this is the error message password is not valid and if password is valid then then we required a two important lines which lines record inserted successful message and also need to go to the another activity which activity login activity is registration is successful then redirect to the login activity to log in that user okay but one more thing is that here we need to insert that data into the database all right so before that we just check or validate all these things here so we just rerun this application redirected to the registration page first we click on the register please fill all detail okay now we are entering all these things here yeah register please password and confirm password didn't match I think one more thing is missing um that code for that email actually email we need to change the input type input type is email address okay so that is also validated for that email okay we rerun yeah user ID email password confirm password uh password and confirm password didn't match text email address okay so if it is match one two three four the another one is also one two three four yeah at least eight character so I'm just write the N is capital n i l e s h Nilesh at the rate one two three check it again register a record inside good uh yeah for that email address I think uh uh edit text registration email and then it is that email text email address okay okay just need to pass here the email address in in the proper format uh for that if you want the don't show the any on the email ID validation then you need to write the some explicit code like this one just write one more function to check the at the rate symbol is exist in that in input field and also write a one more if condition okay so um I am going to write here the sum database related code so for a database first we need to uh create a one one separate file okay DB connection file in the DB connection we just create a one database connection and uh writing the some others functions also like registration login and other things so here in that project I'm going to create a one class new new Java class yeah so class name is that the database yeah this is the simple class need to extend that class to sqlite open helper okay and need to some or write some methods so we just Implement method both methods on create an on upgrade okay we required to actually I think uh one more section is pending create the Constructor so okay so that Constructor is in here like the database text context actually then name database object means that factory object and the version okay fine then we are going to use the oncreate function okay oncreate function uh means that if the table is not exist in our database then then that compiler create a new table okay and on upgrade just update the table okay so here on create I'm I'm writing a one one query uh create table users username email and password so these three fields are in here and using the sqlite database object okay this one parameter SQL database object we execute this SQL so after executing that table is created okay in Android uh by default database is that the sqlite database so in sqlite database that table is created okay so after this table is created we need to write a one more function um explicit function like I'm just going to write the register function for the register the new user and which fields are required I am just going to pass the username email and password as a parameter okay so for the registration we need to use the content values class so content values we just create a new object and in that content value we just put all the data first parameter is the key name and second one is that the value name so first one is the column name and second one is the variable name which values you need to replace to that the username so same as the email and the third one is that the password yeah I'm just uh write all the values in the in that contact value object after that we need to create a object of the sqlite database okay like this one so escalate database DB equal to get writable database why write table because we need to insert that data into the tables so for the insertion updation deletion we need to get writable database I mean and if you want to fetch the data then on that time we use the gate writable database then DB dot insert method okay so pass here the table name so your table is that the users this one and the pass the second parameter is the null column hack actually so we don't have any null column and the third parameter is the context value object you see okay then we close the DB connection okay yeah so we need to call this function in this register dot Java file mean that that activity so for that we need to create a database class object okay so here uh inside this button here we're going to create a object of that database I think here we will create object here yeah database DB equal to new database this is our this is our recently created a class but see here in that Constructor required this this parameters are actually context uh then string name and the version so see the first parameter is the get application context okay get application contacts the second parameter is uh like you are the database name so I'm just going to pass the database name is that the healthcare third parameter is the factor actually here we are not using the any fact P so just pass the factory is at the null and the version here we have to pass the version is that the one so create that object and here DB dot just call a register function and just need to pass the username email and password all these fields yeah so after calling this function we register we successfully register the database and we insert all this data into the database and after that we have a option to enable to that application okay so just rerun this code and check it again yeah so I'm just going to pass the username is that Nilesh email ID is that the Nilesh at gmail.com this is just my dummy email ID okay password is uh like just pass question register record inserted means that registration successful now username is that Nilesh and when uh yeah actually we we don't write the in code here on like database related code right and one more thing is that we need to write create a one more activity like the home activity home user activity so I'm just going to create a new activity first activities that the empty activity home activity yeah so in that home activity um just passed this is the layout uh yeah activity home just set us some some background actually then after that we design that activity just set one background image this one just checking that user is able to log in or not okay yeah I'm just going to close that activity home activity and for that login actually we need to write more functions in the database file first function is that the check that the username and password are correct or not okay and another function is that uh may not require another function we just need to write one one function just the login function so for that login and just return the int parameter okay and check pass the username and the password these two parameters here so initially my result is that that 0 and we return that the result variable yeah so for that select query if if you if we check the username and password okay and for that cursor object we need a cursor object actually before that sqlite uh database DB equal to DB equal to gate readable database because here we required the select query we just want to fetch the data and match the username and password to the specific user okay so that's why here we are using the gate readable database function then another uh object is that the cursor object DB dot we just passed the raw query and my query is that the select star from users where username equal to question mark and password equal to question mark so for that question mark we just need to pass the second parameter second parameter is that the Java dot uh for that raw query yeah check it again the raw query the second parameter is the arguments and that argument is must be in a string array string array so for that we just I'm just going to create a string Str array there are two question marks so the length is that the two right the first index is the username and the second index is that the password and just pass this Str and parameter okay so that cursor object is created now here we are using our if condition if C Dot move to First means that if there is one there is record if there is record then we set a result is the one means that there is some login record is found so that's that in that case they are going to that if condition if the any record is not found then then on that time this is not going to that if condition so if result is one means that the user is adjust and if the result is 0 means that user is not existing yeah so we need we we are going to use this login function in that login activity page so going to the login activity and uh here uh after matching in that L scales first we check if again need to use the database object so I am just copying this line here database same database Healthcare so if DB Dot Login pass the username and the password and we get a value is that the one one means that login success yeah login success and if it is not match it shows one message invalid username and password yeah now if the login is Success uh again we need to redirect to the new activity the home activity okay now one more thing is that uh when we need to save the some login detail in some local memory login user retail means that if the any user is login and we want to display that login user username in that home page or any other activity page then on that time we get the username data from that memory location and display that the username so like session and cookie there is there is a One More Concept in that Android so that concept is that the shared preferences so this is like some some small memory to store some data okay so we just need to create a one object the shared preferences and then we need to add a one string so see here before redirecting to the new activity I'm just going to create one object of this shared preferences share get the shared preferences this is the preferences name and the this mode is that the private mode then we need to create a one editor okay and in that editor we just put a one string username is that the username and editor dot applied to save the data with key and the value so this is key name this is the value okay so I'm just going to close this activity I think everything is done here yeah I think registration is also done and the login is also done yeah check again we just rerun this application we check the Nilesh username is register or not just nilish and one two three four oh login success something went wrong [Music] um [Music] um so in that device File Explorer [Music] is checking here the database is created or not data again data our Healthcare is our the package name so com Dot example actually dot example Dot Healthcare yeah I think that Healthcare package is created not today no actually this is not our com.example.healthcare so I'm just going to remove this thing this this date is the 26 date but I'm just going to delete all these things here because uh before this project for the testing purpose I am also created the same package project on before so that's why that database is overwritten okay now I'm just removing all this file again we need to register the new user so for that we rerun this application then we register a new user Nilesh at gmail.com Nilesh at one two three register registration successful one two three four yeah invalid username and password yeah good Nilesh at one two three yeah login success check in the device Explorer uh the modified data is that the this now we need to just refresh this page uh synchronizes the refresh that database is created this is the two digit this is the today's timing yeah that that table is created is that this is our the fresh database table yeah good registration is done login is done now we are going to design the home page so in this uh home activity yeah yeah we required actually a total six uh card reviews so for that I am going to use the relative layout okay so divide each and every card um in equally space okay so going to code and just change the layout is that the relative layout relative layout okay so width height is the match parent it's okay so background is the back two and all these contents are okay so first I'm just going to uh display here the first label is that the heading like 24x7 headline okay so for that so just text view uh width and height is that the wrap content wrap content is used to um the space whatever is required to that text view okay and give the one ID so ID is that the title home title home okay then then we give the text so text is that 24 by 7. Healthcare then set a text color it's white then give the text size 30 or 34 then set a text Style so we set a style is that bold and we set a center horizontal is true okay set some margin okay so margin top 12 uh margin uh yeah okay okay fine instead of top if you set a margin equal to 12 so set all side margins Left Right top bottom for 12 DB okay yeah so close this text view then for the card view I'm use the grid View okay and weird height is that the match parent use total uh not a grid view grid layout actually great layout and use the whole width and the height then uh this layout is display the below of below of ID name is that the title home title home okay then we set a margin 20 to all side okay see here this this one is that the grid layout 20 DB then we divide the grid into the two columns and three rows so total six cards okay now inside this inside this grid layout inside this grid loud there are total six cards okay so card means that there is a one card view Okay so card View Android dot cardio.visit.com so I am going to use this card review and inside this card view uh first we set some property to that card view like width height so first we set ID is that the this card is the card lab test okay then the second we set a width bit height so with we set a wrap content so set a height wrap content then this is the row number layout row row number zero and column number zero means this is the first sale okay then we set a row weight row weight is that the one okay also set the column bit also one initially they use the whole Space because there is no other cards then we set a layout gravity layout gravity we just use the field yeah fill those spaces then we set a background color card background card background color so add color we use our teal color tail till 200 yeah looking good this is a card background color then we just card Corner radius just paint the corner eight pixel 8 DB also the elevation card elevation ATP and uh card padding card use compact padding yeah true okay so uh some space some space are here on on all sides okay okay so these properties are set here inside this card View this is my first card view right so this first card view uh we need to display one image and one text so so these two components are bind in a one layout and that layout is a linear layout linear layout is under the card layout okay this is also wrap content wrap content then we set a layout gravity is a vertical and if this is not vertical then set alternate gravity is that the horizontal gravity then we set a gravity is at the center and the orientation is very important vertical yeah means that inside this linear layout if we use the two components so these two components are displayed in vertical order so we are using the one image and one another one is that the text View so first image View uh image view use the wrap content wrap content with type and set the image source is the home so inside this drawable drawable home image yeah right then second one is that the text View so again textview is the wrap content wrap content and the text is that the lab test okay then we set the text align is the center then we set uh uh text color say text color is the red color color red then we set text Style is the Bold yeah okay so see here the properly structure yeah this is the structure actually one card View and inside this card view uh there are there is one linear layout and these two components are displayed in a in a vertical orientation order yeah so I am just copy this card one more time copy the card View uh just need to stack yeah so again copy the card View Ctrl C copy paste yeah this is the another one so for that second card View for the second card review the my card view uh name is that the card buy medicine yeah so wrap content this is the row number zero uh and column number one yeah so this this card is divided into the two columns and rest of the part are the same we just change the image image is that another image is that the language and by medicine okay again uh third card paste third card so third card is the card name is that the card find doctor find Doctor wrap content wrap content row number one yeah row number one column number zero right all other parts are same change the image images I have image chat chat image and change the find doctor okay again paste one more card card number four Health Doctor Health Doctor wrap content wrap content row number one column number one row number one column number one okay change the image image is the for example calendar image yeah and the name is that health articles okay then card number five order details row number two column number zero okay then image change the image widget name is that the order details order details yeah and card number six so card number six name is the exit card card exit the row number two and column number is also uh no no column number is one yeah right yeah images um cheek yeah info image yeah info image and the name is that the exit exit or logout just yes so that design is ready [Music] okay yeah just I'm just um relogin sorry rerun this application yeah looking good okay okay so I think uh I'm going to the home activity and adding here some uh some event actually card event when we click on that card not on image not on text when we click on that card we need to uh evaluate some some event actually or activities so uh first uh we just display here the one post message like welcome delish or welcome the username so for that we get the shared preference text we have already saved see here in the login activity we have already saved the username in the local memory with the help of Shadow preferences so with the help of shared your preferences again we create one object okay and get string with the same key name okay and store that value inside in the username variable and this is the toast message welcome username yeah after that here we create object of card View so first we make the functionality of exit button okay and find view by ID r dot ID dot my card name is that the card exit and exit dot set on click listener okay on click so on click first we clear the username uh whatever username is stored in the shared preference variable so we need to clear that memory okay so again here we create a object of the shared preference shared preference Dot editor is equal to the previous object of shared preferences prayer dot edit and editor Dot clear all the key values information also editor dot apply apply to that changes and the start activity and go goes to going to the or jump to the again login page okay this is current activity this is a jump activity login activity so when we click on that log out we cleared everything uh which is stored in a shared memory or the local memory and after that we jump to the login page Okay so after that uh first we make the functionality of a lab test or the find Doctor anyone Okay so let me create the first functionality of a find out so for that we need to create a one activity so right click new create the activity blank activity empty activity and the activity name is that find doctor find out yes and yeah here we need to create a uh one more card object find Doctor object so object is that find doctor r dot ID Dot fine doctor find doctor on sit down click listener yeah again on click yeah just jump to the find Doctor activity this is the current activity this is the find Doctor activity the jump activity find Doctor activity dot class okay so for that the find Doctor uh first we just change the background so we set a background is that um background okay and change the layout is that again relatively out because there are multiple specialist doctor and we have option to choose the specialist doctor so again we use a grid okay there are five different specialist and last button is that the back button so like the similar uh previous one home page so first one is that the text tool okay that text view is that the title find doctor and the name is data 24x7 okay so check in a parallelly here 24x7 okay there is one more text like just a heading this is the top doctors this is another text View title uh find doctor Top Doctors yeah text is that the top doctors and we set some start margin top margin margin name whatever you have to require just set the sum numbers okay yeah then there is a grid layout so we set a grid layout like the uh three rows and the two columns similar to previous one and this text is below to this title second one copy paste below of this top doctor and we set a margin is that at 20 to all sides column 2 and the row is that the three again for each uh for in in Grid cloud we use a one card okay same as the home so you just copy paste to this card and we change the background color is that the purple dark color and this set is that the row 0 column zero okay wrap content wrap content this is a card lab test okay I think we need to change the name so name is that the family physician card find doctor means that FD family physician why FD because this card is under the family find Doctor page so that's why FD is initial to make the some unique ID so that's why yeah inside this card view we just create a one linear layout again there is a one image and a text yeah so say the orientation is that the vertical and there is one image and the one text so image is the uh family physician image this one and we set the width and height is that the 170 because this image size is very large and we set a text is that the family finishes here okay so we just copy this card view one more time here and change the name ID name uh as well as image name and the text name okay so we set the second card here this is my second card so we change the card name is that the card FD and this is a dietitian this specialist is The dietitian yeah so dietitian um we said that card is this that is the row number zero column number one and this is the image that is an image this is the text yeah then card number three yeah card number three is the dentist so here card FD dentist okay again this card is display row number one column number zero image is the dentist image and text is the dentist okay same we copy the One More card number four card number four is the surgeon card FD surgeon yeah then card number five card number five is the cardiologist cardio list okay so if you have the more option then use more cards okay so this is a learning project so I'm just going to use the only six cards yeah so this one is uh card view is closed here okay yeah here copy this card this card is a cardiac cardiologist card FD yeah cardiologist and the last card is that the back button if the user want to go to the again home page okay yeah this is the back button FD back okay uh text is that back good so save this changes rerun the application uh we need to check the two cards find doctor as well as the log out okay login yeah find Doctor yeah this page is redirected to the another page find doctor Page okay and these are the total six options now uh uh we we didn't write any function data to this back button okay so I'm using this back button check out the log out here logout is successful yeah okay good okay uh so move toward the uh find Doctor uh card functionality right we need to write the sum uh again event card event so in that find doctor Page now first we write the exit or the back button functionality okay so my card name is that the card FD back okay and when we click on that back we go to the current activity to home activity right so we write the functionality of a back then uh the first is the family physician so when we click on the first card then we we need to redirect to the another another activity so we use the common activity of all cards Doctor Detail activity okay Doctor Detail activity and we just use the some title like the family physician like dietitian dentist or cardiologist we send that the name to the one activity to another activity with the help of intent okay so for that here I'm just set the one more card view functionality so this is the card card FD family physician so when we click on the family physician then this is redirected to the Doctor Detail activity okay so I am going to create a new activity right click new empty activity this one is the doctor details activity finish yeah so this redirected to the doctor details activity dot class and one more thing is that with the help of intent we set a family physician as a title key name so this is one value and we when we redirected to the doctor did US activity we also pass a one message from one activity to another activity okay and start this activity so same as family physician we just add a another cards because we have a other cards also by medicine okay not a biomedicine actually this is The dietitian so FD dietitian dietitian and dietitian dot set on click listener again we set a title is that dietitian and redirect it to the same activity doctor details dot class then third one is that the dentist so for that dentist we use the card FD dentist yeah redirected to the same activity doctor details and said the title is that the dentist then then this is the card surgeon yeah said the title is that the surgeon and the last one is that the cardiologist [Music] so card FD cardiologist said the title is that the cardiologist okay we we set all the events image that said the event of each and every card and redirect it to the same page doctor details activity okay so in drop in Doctor Detail activity uh first we need to design uh this page uh here we just display a one one heading 24x7 and another text and the one list view in that list view display the sum some uh some doctor's name ah which is The Specialist of some dietitian or family physician or or anything okay so for that in that the doctor details dot XML we split this page yeah this is the constraint layout it's okay so first we use the one text View okay same as the 24x7 which are used in a login and registration page okay so I'm just copying this here uh set the background we said the background is that the back one this one okay and see here all these fours are set here for the constraint top bottom end and this one yeah and we set a text View uh Doctor Detail title Doctor Detail title okay then another another text view is that um I think this is we said this one is that the um name and the title is the another actually uh we set the title here because we have already passed the title here this one right is shown or this one so that's why our title is the another text view okay so we have option to drag and drop and set us some constraint yeah and this is the bottom of this name yeah family physician this is the default text actually here will be just your default and text View Doctor Detail title yeah yeah just you have you have option to just like drag and drop here and set some line to here left right top and bottom so for that these four lines are come here and this is a common property like side style and colors and the text then there is a one list actually list View so here I am going to use a one list list view so list view uh we set a fixed width and height or just use the width is that the wrap content and the height is the content [Music] then we set a margin okay margin 10 to all side and this is the below we need to set the below property as well as the start property okay so this text view is the bottom of we use this one bottom of title yeah bottom of title good I think we set in scrub margin uh I think we need to set up padding padding foreign okay fine uh yeah then we also need to set some start off end of property um um this text View now I think on bottom there is one button back button so 605 oh not set any bottom property um checking a code parallelly yeah bottom of parent parent parent parent okay margin start top end okay with tight set of an ID is that the list View doctor details okay list view doctor details fine uh there is no width height actually when we set some height Okay just set some height so find it is okay and there is one more button back button so ID is the button DD back uh bottom of parent parent start of parent okay yeah fine okay so uh first we need to display uh some uh title name actually we need to get the intent value and displayed in a in uh title text View right so for that here we just use a one text View text view is TV and just map here text View DD title okay then we create the create the object of intent and get the value of title okay this is the intent object get intent we get the key name title and set that title to the uh title text View okay now uh also we set a back button event so there is one button yeah so button find view ID r dot ID Dot button DD back and BTN dot set on click listener on click listener and we just jump to the activity to the previous page find Doctor activity so Doctor Detail activity to find Doctor active previous activity is the find Docker activity yeah okay so we just cross check if title is set or not and checking the activities going to the back or not so rerun this application uh for the initially I need to login every time so for that I am just comment this code whole code and just jump to the home activity directly yeah okay after completing this application then we again uh uncomment this code yeah click on that login going to here find Doctor yeah uh these are a total six card when we click on the first primary position so this is the family physician title is set and back button back dietitian dietitian name is set here back dentist name is set here back surgeon yeah cardiologist and the back button to the previous activity okay so this works smoothly now uh here we need to set us some some doctor name String array this is actually beginning project so that's why I'm going to create a one hard-coded array so we have option to get all the data from databases all right create a one Doctor Detail table set one column like the type of that doctor okay and depending on that type fetch the data and display in the list View so for here initial purpose I am just set some dummy five doctors here yeah this is the one string uh doctor name Hospital address total Experience mobile number and this is the consultant fees in Indian rupees okay so this is a Doctor Detail one so I'm just copying uh five details yeah this is the five array Doctor Detail two Doctor Detail 3 4 and 5. okay I'm just setting here the some hard coded array then uh we set up one more string uh all these strings are documented one two three four five here we create a one more common string string uh uh array actually two dimensional array Doctor Detail right and this is my empty array yeah so depending on the type of that title type of that title we set up we set a array to the doctor details variable so use here the one condition if title dot compared to so if the title is the family physician physician c i a n s and this is equal to equal to 0 if that string is matched then doctor details equal to we set a first doctor details yeah same else again if copy paste two three four five yeah so second one is that the diet is here right second title is that the diet is here third one is that the dentist okay then surgeon okay one two three uh family dietitian let me just use a surgeon for a fourth number and use the dentist and the last one is the cardiologist so for that follow cardiologist we not require the use just use the else yeah so this is the details too three 4 and 5. yeah depending on the title we set a doctor details to this common variable Doctor Detail variable yeah now we need to create a list object and release object so for that here we create a one declare a one arraylist and also need a one adapter simple adapter essay I released java.util yeah so create the object of that list all right then here we are using a one for Loop and we are using a one hash map and set here total there are total of five columns one two three four five and we split uh the whole string okay uh and divide that string and copy separate string to the separate object of the hash map so for that here I am using the one for Loop for int I equal to 0 I is less than doctor details length and I plus plus yeah so first we get the one item so we create a one hash map object okay we declare that object on top of the class here hashmap string string okay yeah so create the object of that hash map then we put we put the all the doctor details 0 1 2 3 index wise in the four different strings one two three four and one more is that the fifth number string fifth number string is that the consultant fee okay so for that consultant fees uh consultant feeds this is the charges amount and this is the symbol of the uh rupees actually so that's and here I'm using in other countries use the dollar symbol then Euro symbol like this way and we add this item in a list yeah add this item in a list so after that we need to create a simple adapter object okay so here uh for look it's closed yeah s a equal to new simple adapter so first parameter is that the context so context is the this or the get application context second one is that we need to use a one layout actually we need to use here the one layout string so see here we have already thing we don't have we need to create a one layout okay so that layout is the just the multi-layer multi-line layout actually okay I'm just going to create a one new layout layout resource file file name is that the multi lines and this is the under uh the root element the linear layout this simple layout actually linear layout okay create yeah in that layout this is the linear layout and uh uh vertical match parent set the background is that the black color okay then we use the padding space keep the space is the 8 pixel then height is that okay and set the orientation orientation is default is at the vertical this is okay and we set some different text view here so first text view is the ID is a line line a match parent width height is the wrap content so this is default text text color some size and style is that the italic so another text view is that the line b means that the second line okay this is the second line okay we are going to create a custom list view actually okay so this is the second line text color is that the yellow then uh for the remaining three text view I am going to create a one um horizontal layout okay so for that I am going to create a one more linear layout here for the row number three yeah so row number three is that this layout is orientation is the horizontal okay and for that first text View this one this is the first text View then we required more to line C D and E see this is looking like this way this is the first text view second takes you third fourth fifth and we set some width also and this is a one list view item I am going to create a one custom layout list okay Okay so lion the name is that c d e okay a b c u d e so these are the some elements so here my second item is that the r dot layout Dot multi-line okay third parameter is that um new string and we set some title like line one line to line three line one two three four five okay keep entering yeah one two three four five comma uh next one is that the new wind r dot ID dot line a right this is mapping actually line B C d e okay uh is that okay or something missing yeah second parameter is missing a second parameter is list object yeah so see here second parameter is list object then this is the resource from and two yeah so from and two okay now we create a list view object because we we are not mapping the list View all right we're just mapping a text and button so text View LST equal to find view by ID r dot ID Dot uh list view DD yeah then after that we set list dot set adapter s e s a adapter we said this adapter to this list yeah check again we just rerun this application and check that all these data the string data is displayed in a list or not login find doctor yeah this is the specialist we need to use some fixed width to that list actually uh uh you have to go doctor details yeah with yeah it's okay against Iran login find doctor yeah looking good back dietitian yeah back dentist yeah back surgeon back cardiologist back yes so this text view is divided into five categories so this this is a custom list view actually and we divide these five strings you know even in that way okay now we need to click on that list item and redirect it to the book appointment activity okay so for that here we just create a new activity the new activity is that the book appointment activity book appointment activity finish yeah need to pass all this data doctor name Hospital mobile number and consultant fee two from one activity to another activity and for that another activity we just book that appointment okay yeah so um so first we need to design this is the book at uh book appointment dot XML file first we set the background color so background color is the background okay so I'm just copying uh the registration UI details so book appointment and register yeah so design just copy three I think uh and just copy everything copy and encode paste okay then in design uh so I'm just shift these things to song yeah so we rename the registration as well as a appointment book appointment then this is uh the appointment person full name yeah I just need to change the hint full name and we also need to change the ID yeah edit text app for the appointment sorry full name then then second one is that the address app address I also need to change the hint or address we just shift this icon to a position is that we need to change the icon so here use this secret icon here then third one contact number contact number change the icon and last one is the consultant feeds feeds let me check the some other icons uh I think there is there are only three icons here okay fine fine yeah then uh this button is the book appointment button book apartment for uh it's okay book appointment Button book appointment we need to remove these things we also need to uh copy one more button here for the back button app back and name is that back so I'm just removing this up and shifted this button on downside and here I'm just adding the booking appointment date and the time okay so for that I'm just drag and drop the text View and one date I think for that date we need a date picker actually uh just search here foreign for the date picker yeah I'm just using one button actually and we sit the style is that the spinner style so like the drop down okay so uh this is one button okay I need to set some property I'm just setting the property in here by code so we just change the text for this text View select uh appointment book select select the date okay then we set a color is that the yellow light color okay then in this button we said the style is that the spinner style button this one check in design this is like the drop down this one okay and uh we set up one default text just just for the any any random date so 27 I'm just mentioning mentioning the format is that Ddm myy okay so wrap content wrap content yeah we said uh ID button app date okay then uh we need two more things on right hand side deliver time also so I'm just copy this paste one more time for the time okay and same here I'm just copy the same button again here yeah so again going to the code yeah so this is the select time and this set one Default Time default time is that 10. all right oh yeah I'm just going to control Z yeah we need to change the time here yeah just for select time and this time is the Den okay then we set this is under the feeds this is also under the fees all right same here this is under this field this is under this field uh need to set some ID so that ID is that button update button app time yeah then this is for yeah and this for okay fine I think everything is properly set okay looking good uh checking code what are things are pending uh but I think uh more constraints are required yeah okay foreign yeah code is error free yeah good okay now we proceed to the uh first thing is that we need to add a click listener for the list view okay so when we click on any list item we need to redirect to the book appointment activity so for that here LST dot set on item click listener event okay then we override the on item click listener method and there is one more method is that on item click so for that first we create a one intent object because we need to redirect to another activity so this is the current activity this is the jump activity book appointment so when we're going to the one activity from another activity we need to pass some data which data all the data this one like the for the text one is the title text is the doctor details so 0 1 3 4. 0 1 3 4 uh for the second one I think there is some description um doctor name I think zero one two I think experience is not required on book appointment so for that we skip that the second index item so zero one three and four so we pass all these data and after that we start the activity okay so when we click on the any text item so that data is passed from one activity to another activity okay then uh in in book appointment activity page here first we need to retrieve the data from the intent and store all the data in all the edit text so for that first we set the four edit text and one one is the title actually text View so we set the four edit text and one text View then so a text View Title so I'm just checking here this one is that the title so I'm just set here text view app title uh that title is required or not wait this time just canceling this one okay uh okay here we just display here the title of that the doctor actually means that the specialist of that the doctor it's okay so I'm just change here the text View title okay so here text View app title then this one edit text app uh first one is that the full name second one is that the address third one is the text edit text contact then edit text fees okay and one more thing is that we need to remove the click means that that all the edit texts are not editable actually so for that I am just copy here the all the uh key listener activities that are not is that edit text is not editable all four edit texts are not editable they just display all the details from the previous activity to next activity okay then we we need to fetch the data with the help of intent so this is the intent object then get string extra text one two three four five and we set all these information to these variables title full name address contact and feeds and after that we display all these variable data to the edit text so edit text set text set text settings okay fine so we just need to cross check uh this code so just rerun the application so find Doctor of for example family physician for example I choose the third one so nilcari click on that see here this is the doctor name Hospital address uh yeah yeah I need to change the some information because these are the um password okay okay fine so I'm going to here in this code I think there are the multiple edit text this is the first edit text feeds for that feeds input type is the person name text person name okay then [Music] feeds 20 DB I think everything is okay all right the second one is also the text email address this is also a text person name text person name okay I'm just choose the dentist yeah mobile number and consultant fees all these informations are shown here okay so this is the dentist is the title then we need to select here the date as well as the time yeah so for that we need to write the custom code of the date picker as well as the time picker okay so uh in that book appointment I'm just going to create the two object one is the date picker dialog and the second one is the time picker Dyno so these are the built-in classes in a Android so just declare these two objects and need to create need to create a the calendar actually okay right so uh in that date picker I'm just going to create a one function you need date picker you need date picker uh this is the date button actually um I'm just initially just comment this line yeah so date picker dialogue when we uh this is the function actually when we click on that button then this dialog box is shown here and this is the calendar object get the current year month day of month this is the style and uh this is the minute actually we set here how much duration is displayed in that calendar okay so similar uh we need to write a one more function for a Time so similar this this is the another one is that the time picker this is the init time picker okay on time listener this is the calendar we get hours and minutes yeah then uh these two functions need to call uh to this date picker dialog and the time picker dialog on click event Okay so uh we need to create a two buttons one is the date button and another one is the time button okay and need to create a find view by ID it's mapping so this button is the button app date and button app time yeah so mapping is done and uh [Music] here foreign first we need to initiate means that the call the date picker function and after that this is the set on click listener method and we just uh show the date picker dialog okay and here I'm just comment out this line this one is also and same as the time picker time picker first we call the time picker function and then set the event click click event and we just need to show the dialog box so for that dialog box [Music] for the dialog box uh yeah when we uh when we call this function init date picker so in that init date picker this object is created here okay and that's that dialog box is ready and when we click on that button that then that dialog box is shown here okay just check just checking for that uh the um date picker of the date as well as the time okay so the rerun this application and check it again login find doctor yeah click on here yeah this is the date picker okay and just that that date are shown from the uh tomorrow date today's date is that my my recording date is that the 27 October so but uh from the next day is that the 28 October that appointment is booked we we didn't select the previous date why because here uh we we make the some restrictions the which restrictions here we date we select the current year current month and the current day of month month year day of month yeah and uh for that you need date picker this is the style and we select the year month and the day okay and uh on date set I i1 I2 yeah here we increase the this is the actually year then day then month I think uh there there are some three different uh things so I2 i1 i1 so this is the i1 actually we increase the i1 plus 1 okay we also restrict the time I think not required for the time so we choose the anytime okay yeah so this is the time picker dialog box and this is the date picker dialog box we have option to select the date and the time means that the booking date and the booking time for the appointment okay need to write the functionality of the back as well as the register okay so here I'm just going to add two more buttons uh yeah actually here for that register we just need to change the name book appointment right book Amendment yeah then BTN BTN book BTN back okay and here first one is the BTN book button book appointment button app back yeah right okay so we just write the event functionality so first we write the back so BTN back dot set on click listener new yeah we just redirect to the previous activity previous activity is the find Doctor activity directly yeah book appointment activity to find Doctor activity when we click on the back button and when we click on the book button on click yeah we need to save all this data into the database right we need to save the data in a database so for that I'm just going to the database table and need to create a one more table here right so I am just going to add here another table is that order place table okay and we save the data like the full name address contact number [Music] um uh I think um we need to work on the another activity also is that another activity is that the lab test activity in that lab test we also need to book the lab test so Also regarding that we have some other informations so I am just keep this code uh as it is because after some time after designing all this activity of a lab test then we need to write the both functionality related to database in parallel okay so I'm just keep the book appointment code as it is for some time so first we just cross check the rerun this application and check all this functionality related to book appointment so find doctor dentist everything is good we also have option to change the date 29 we also have option to change the time good book appointment back button okay good now we start the code on the lab test then buy medicine held article order details and others okay so I'm just going to remove everything yeah this is my the home page home activity right so in that home activity home activity page this is my the first cardio right find doctor I need to write one more card view for a lab test so for this lab test is the card lab test for ID I think card finder yeah card uh card lab test yeah right then this is the event and we need to create this activity right click new activity empty activity lab test activity finish yeah in that lab test activity first we uh design this page uh same as the doctor details yeah same as Doctor details uh there are some buttons same list view heading and some text buttons all these things are common so I'm just going to copy everything from this doctor details to lab test code and we set a background is that the back to okay and we said that the deliver location so this is the just a beginning beginning project so we said means that we deliver the lab test or any any things in specific one location hardcoded one location okay so that's why I'm just uh use here the deliver location is the in one of the con one of the city in India Pune okay so here just change the text deliver location okay and we need one more text here like just heading for the lab test and having a different packages set the text color as a yellow light okay and for the delivery location we change the size just for the 16. okay yeah now there is one back button we need one more button here copy paste this button is here yeah so this button is the go to card button we need to save the lab test data in card okay so we we need to save the anything in a card and after that after checkout time we retry all the data from cart and make order okay yeah so go to cart and the back button so go to cart button LT go to cart LT lab test go to cart and refactor this is also back button LT back lab test back this is a text view sorry list view list View lab test yeah refactor then okay fine we save all this data so when we click on the lab test so that activity is called lab test lab test activity dot class again just for the testing purpose we just rerun this application yeah good go to cart back yeah okay so need to write the functionality for the lab test so first um we need to display the sum information uh which information like some some lab test activity like for example we have different packages like full body checkup code 19 antibody igc thyroid Checker humidity checkup blood fasting black that way so for that we just create a hard coded stream okay hard coded string uh one is the for the packages okay so for example this is the full body checkup and these three details are in a blank uh because why why we just pass the 3D data is a blank because we used a same multilite custom text View and in that texture there are total five text fields so for that if we not required the any other text view so for that we just use a blank text so this is the first and this is the last charges and keep all the three other text view string data as a as a null or as an as an empty then same as we just display here the some package details so we we have another uh package details tree okay this is just for the information okay let me just pass all this data here okay now uh we need to uh declare a one hash map object arraylist object and a simple adapter object okay error list simple adapter then for the button we have a different button first one is that the go to cart button go to cart button back yeah then we have a one list list View list View okay here uh so button LT go to card this button is the button go to cart button back list View button LT back this is a list view LT yeah good so first we write the function at your back button this is very simple so BTN back dot set on click listener new and we just call the activity is that the home activity when we click on the back button just redirect to the home activity then uh we need to work on the list View okay so first we need to create the object of arraylist so arraylist is the list so least equal to numerel list and we need to create a one for Loop yeah in that for Loop uh we just Loop the for loop with the help of a package array so package dot length okay five then line one two three four five we set all the string data to that line and line five is the total cost and we add the that item in a list object then need to create the simple adapter object like we have already created in previous one right so it's a simple adapter pass the all the five line string data and this is the mapping line a b c d e multi-line variable uh IDs data so we map all this data here and here we set the adapter for the list view list view dot set adapter s a okay so save and just need to cross check that data so rerun SNAP test yeah these are the five packages display only the first string and last string two three four five keep blank so we just reuse that the same multiline.xml Uh custom list View if you want to display uh this in in another format then you need to create another layout actually for the two strings and call that layout similar to multi lines okay so this is your choice actually then when we click on any package then we need to go to the uh another activity lab test detail activity so in that detail page we just display the package details and that package details are in here actually we need to pass that string data from the another activity so here just mention the list view dot set on item click listener and yeah on item click then we create the object of intent so another activity is that the lab test detail activity so when we are going to that activity we just pass the First Data is a package i0 means that the package name package cost and the package detail ith index position there are package detail total five strings are in are in here so see here this is the first string closed in here this is the first string second string third string fourth string and this is the fifth string so we have a total five strings detail these are like the package details information okay so we just pass that information from the lab test activity to lab test detail activity yeah so we need to create that activity new activities right click new activity empty activity again create this activity here finish lab test detail yeah so for that lab test detail first we set the background choose any one image so we choose the background one okay then then I'm just copy the all the information and see the look yeah actually you you got the idea how to design this page okay so I'm just further saving the time and just copy paste that uh we have already code for that design just copy paste that code so see this is 24x7 Healthcare the title this is delivered location tab test and package then this is of one edit text multiline box okay so see here in this code edit text multi-line and just said the input type is that the text multi-line and just drag to the uh for the bigger size okay yeah just set the width and height is that 29372 so depending on your screen size said that the width and height okay then this is the text view this text View for the total cost this add to cart is the button and the back is our next button so we just need to check the all the IDS so see this ID is the logo I think we not required for the writing the code this is the package name uh text view package name I just need to LD for the lab details is mentioning the LD prefix LD yeah multi-line for this text multi-line edit text LD text multiline and this is the total cost but LD lab details add to cart is the button in a lab detail activity and back button is in a LD activity yeah just this is the simple Design This is the edit text but we said that the style Here style is that the multi-line okay so see again the code this is the back button the first one is that the lab test and package um heading then this is the delivery location Pune then this is a 24x7 healthcare actual this this is the sum codes are [Music] um display for some not for and not for an order actually but it doesn't matter the code is writing in order Okay so this is the add to cart button back button edit text this is the default text hi hello this is another text okay fine yeah now uh here variety of the sum text view object uh first text view for a package name so TV package name and TV TV total cost and this is the multi-line edit text so I'm just pass the Ed Ed details package details okay yeah so first we pass here the package name second one is the total cost text View LD LD package name text view LD total cost and this is the edit text LD text multiline yeah and we also need to uh not modified this edit text details so edit text scale listener is that the null so we we not able to edit that text okay now whatever data we have to pass from the previous activity we need to get that data from that intent okay so we need to create the object of that intent and set all the data to that text View and edit text so text one text to text 3 so first text one data set to the package name then the text to is the actually details this one and the third one is the total cost this one yeah and need to set the actually there are two buttons right go to add to cart and the back yeah here uh two buttons add to cart and the back so in the test details past two button button BTN add to cart BTN back yeah for that back for that back button set the click listener event and go to the tab lab test activity from the detail to the test activity okay and uh yeah for that we just return this application and test that code foreign test when we click on a full body checkup ah got the some exception okay okay uh yeah button back and these two buttons need to map here right so first one is that that to cart second one is the back okay this is actually uh that exception is that null pointer exception because we we just missed that the mapping the component to that uh to that variable so that why null pointer exception is called okay so r dot ID Dot button LD add to cart button LD back yeah after mapping we set some event okay again check the rerun this application lab test yeah when we click on a full body checkup yeah this is the description total cost package detail and add to cart button back button back covid-19 back if you need to check okay okay fine so need to write the functionality of add to cart so first we write that functionality add to cart functionality okay so here uh like this the another one is that the vtn add to cart yeah and here on click foreign so for that um we need to create a one database table actually card table yeah so first we write the functionality of a card so here create table card username product price and O type is that the order type so order type is that the leftist right lab test and we have a medicine options also so that's why in medicine we need to also add the medicine into the cart see here in back we have biomedicine options also the biomedicine and lab tests both having the card options so both cards or the both functionality are worked in under a same table card table okay yeah and this is the query uh execute the query two and uh we need to add one more function to add to cart here see add to cart the parameters are the username then product name price in float and the O type we we like the registration we need to create the One content value object put all these values create the gate writeable database object insert the CV object into the card table and we close the uh DB connection same if that the lab test package or that medicine is already exist in a card so we just need to check that the item is already exist in a cart or not okay so for that we we need to write one more function to check card check card item so for that check card these two parameters are compulsory username and product okay so these two parameters we store in a Str array and this is my other raw query select star from card where user name equal to customer product equal to question mark and if that item is exist in a cart we return the result is one okay otherwise return the result is the zero okay also we need to write a one more functionality like the remove card if if you don't want to uh the cart item just call the Remo card button or sorry remove card function username and or type is is important okay so this is the delete and this is the where condition where username equal to question mark and O type equal to question mark okay so for that we just remove the O type O type all products from the cart or type means that either lab or either medicines okay this is the remove card um function we just write the three function add to card check card and remove it okay again going to the lab test detail okay so see he here uh they required some username data okay username data to insert it into the database so on time of login we save the username details in a shared preference memory okay so with the help of shared preferences again we need to retrieve the username data okay and stored into the one variable so this is the shared preference object get share get share preferences mode dot private and we get the username okay and uh this is the product actually product is the uh product is the actually package name package name is our product name and price price is under the text three okay so text 3 is that see this one lab test yeah this is the text one this is the text three uh in 10 dot get string extra yeah yeah yeah get string x i text string takes three okay yeah so this is the float value we're just casting that string to the float then need to create the database object my database name is that the healthcare database and first we need to check that product is already in a cart okay so if check card just pass the username and product if you if that product is already exist in a card then that function return the value 1 and and in toast shows the message product already added and in else if that product is not in a card not in a card then on that time uh we we need to call the add add card function username product price and the lab lab is the O type actually this is this is the order type is the over lab when we write the function network of medicine then we type O type is that the medicine then show the one post message and need to redirect to the another activity another activity is that the lab test activity so detailed to again lab test means that and uh that message is shown record inserted to cut okay so we just need to check that functionality so rerun this application uh and one more thing is that in login activity we need to uncomment this code because need to write something in in shared preferences right yeah so again rerun yeah please fill all details so Nilesh is the username then Nilesh at the rate one two three login yeah lab test so I'm just choose the package too 299 add to cart yeah exception is detected no search table okay that oncreate function uh database is already there so that's why that table is not created so for that again we go into the device name file explorer and just remove the database yeah check it again where we are in so first we explore the data I can explore the data then check the your package name com.example.healthcare so com dot example dot Healthcare is in here this one so I explore this is your database I'm just removing this database delete yeah okay and again rerun the application if databases not exist then on the time that oncreate is function is executed and on that time these two tables are created okay need to again register a new user so I am just register the same user again Nilesh at gmail.com at one two three register record inserted then release 0.23 login yeah lab test add to cart record insert it to cart okay so when we synchronize so this is a 20K database okay if you want to show the tables in that sqlite file you need to install a third party sqlite viewer application and in that sqlite viewer you just open this this database file to that application okay okay uh now that item is stored in a cart I'm just going to add one more immunity check add to cart record insert to cut I'm just adding two items in a card okay so for that if you if you want to show all the items from that card then we have order detail card here so for that order details order details we just need to check the I think uh we have optionality uh go to cart yeah that functionality is pending go to card when we click on that go to card button then we need to show all the products whatever we have to add it in a cart right then on that activity we need to add one button like order that product all right Okay so so here when we click on black app test so this is a lab test activity and we need to write the event on go to cart yeah this is the button to cart and here button to cart Dot set on click listener and here uh we just redirected to the new activity card lab activity okay we need to create that new activity so right click new activity empty activity finish yeah this is the cart lab activity yes so this cart lab I am just make a design of the sample page first we set the background and I'm just copy paste the code this is my design okay so uh just need to change the all the IDS so going to design yeah this is the text View text view cart ER text view cart I think package name then yeah refactor then this is the list View uh card refactor then this is the total cost text View cart total price then this is the date so button date picker but card date picker and this one is that the time picker card time picker yeah then this is the button of checkout button checkout and the back button for the card back button yeah refactor check it again code uh thank you check out back card not sure why this is not changed okay paste way and just design this all the code step by step yeah uh that code is very similar to this this page so I am going to copy these three things uh as it is or just copy everything in this code section [Music] copy in cartlab okay and in design uh yeah this is the DD not DD card title right refactor check it here changed then this is the text view text view in card okay then this is the button uh dealer location Pune then need to change the size yeah and need to add here the deliver date and deliver time okay so this is the back button cart back button yeah need to change the checkout aim is that the checkout and ID is card checkout okay and I think we have already added the data delivery data and other things in think book appointment yeah so I'm going to copy these four things copy Ctrl C and paste it here Ctrl Z yeah okay uh [Music] select it okay I'm just copy only these four property not for a constraint property we just manage that property after some time go to the code so there is text View then this is the button this button date okay so check it in design section hmm yes and uh copy paste yeah this one is to select time and in here for the time section uh just to need to set the this is also spinner Style just need to set the text is that the 10. okay okay then for this my attribute ID [Music] button correct date and this one is that the button [Music] card time yeah there is one more thing is pending here uh total cost right so I am going to uh just copy this text one more time to here uh let's give card total cost and increase some font size this is the default text like default text is like just pass the one total cost to 100 yeah so this is under this text View yeah then this is again under this cost same this is under same as okay okay fine so check it check it that the code is error free yeah everything is good yes so that design is ready okay now going to the uh card lab cartlab activity.java okay so here first we initial first we declare all these variable so we required or one hash map one error list one adapter one text view for total date picker time picker and two buttons date button time button okay we need more two buttons BTN checkout BTN back okay then mapping mapping is required so we do the mapping so we change here the button cart on cart date button card time same as two more buttons check out back BTN button card checkout button card back okay then for that the back button need to write the event redirect to the previous activity lab test activity okay this is the button back dot set on click listener then similar to the previous code we need to write the two functions uh you need date picker and the init time picker so I am just copy these two functions and paste it here first one is that the unit rate picker and second one is the init time picker two functions are required then uh need to call the date picker pop-up so first we call the init date picker then set call that dialog box when we click on that button same here time okay then uh we need to display we need to face the data from database and displayed in a in a text view okay so before that first we check that we are able to go to the go to cart activity so rerun this application and test it I need to log in login uh um first one lab test go to cart yeah good this is some hard-coded data check it yeah pop-up is shown here check it pop a bit shown here good then uh first we get the username which is stored in a shared preferences so stored in in one of the variable here create the object of a share preferences and get the username because when we check in a database uh yeah we need to the face the data from that cart where username is the login username and the O type is the lab okay so these two things are very important here now we need to create the object of database yeah database object is created uh other thing is that we need to fetch the card data and store it in arraylist so need to create the function of gate card data and pass the two data first one is user name and second one is the lab Lab is the O type actually okay so going to the database file and write a one function gate card data so in database yeah this is the function gate card data these are the two parameters username and O type okay this is a one blank arraylist here we make the object of gate readable database create an array of strings of length 2 and store the username at 0 30 x or type is the first index and queries that select start from cart where username is a logged in username and O type is the lab okay and if there are some data if there are some data here we are using the do value because there are chances to having a more than one data in a cart so we get the data from first index and second index the first index is the product second one is that the price okay and store the data in a array array so here we make a one stream product plus dollar price dollar is just for a separation of these two string so this is one the one of the special symbol okay and after closing this move to first we just return this arraylist ARR this arraylist and that arraylist here we we store all this data in arraylist here okay after that uh we just want to display this arraylist data in a toast just for a testing purpose just I want to show that the data is coming or not so toast Dot yeah make text so this is the DB data yeah so just check that just rerun the application I think we have two data in a cart lab test go to the card yeah you see here these two data package to package file means that we are successfully able to retrieve the data from database now that data is in a arraylist we want to just split the data into the separate variables need to set some for Loop find the total amount okay so first uh we just create uh packages packages is our black string right one create a one blank string packages two dimensional string so package is equal to new screen first index is the total length of that arraylist and second one is that empty and here the second length here we set the five five columns okay I think uh you you remember that in in that lab test activity or other activity where we have defined already all the packages there are total five columns so that's why here I mentioned the hard coded number is that the Phi hmm then we need to create a one for Loop yeah in that for Loop this for Loop Hills also goes to the DB data dot size okay so here we split the string with the help of dollar symbol and we divide that string into the two separate variable so first index stored in a package index 0 and this first index is stored in a package index fourth so this is the cost this is the package name okay and here we have to find the total amount and need to pass into the float and after breaking this Loop we set the total in a text View okay so I think we need to able to these are the four buttons here need to find the total and total is that the text View card total cost right so text View total cost also we need to uh title is the title here no okay fine yeah see here uh we said that the total dot set text and this is my the total cost yeah we just first uh uh no this is finding the total cost uh next thing is that we have data in arraylist right this this DB data and we just pass all this data into the packages now all the data are in a package package array okay so now I have to create an object of arraylist okay because we want to store display all these data in that list View and in that for Loop we have to create our own hashmap store all this data in line one two three four five map this data into the multi-line uh multilide layout with the help of adapter right and after that we display into the list View yeah uh in that list View yeah declared here LST and another thing is that mapping is also we have to shifted in here find view by ID list View got it yeah and after this for Loop we have to set adapter s a okay so rerun this application and check it again back in lab test go to card yeah so these package to end package file and the total cost is 998.0 edition of 299 plus 6.99 it's the select date and select time okay I'm just going to back and add one more thing back uh package four add to cart go to cart package 4 is also there okay uh I'm just trying to check if uh when we try to add the same package one more time so back package 4 add to card product already added so one package is added only one time yeah just we just comment this toast yeah this is just for a testing purpose now this is our the final entity checkout uh on that entity we just place an order okay so when we click on that checkout button we just need to redirect to the uh another page another page is that the checkout page and on that page we just pass the total price date time date time and the total price okay and there are some basic information order details like the name PIN code and other things also okay yeah so this button is already created checkout button I'm just going to write the one more event of the checkout button this is the BTN checkout and when we click on that button we need to create an object of intent okay and going to the lab test book activity we need to book that activity okay and uh put some data we need to pass the price date and time and after that we have to start an activity okay need to create this new activity so copy right click new activity is then empty activity finish okay lab text book activity yeah this one so here in this code section first we said one background color and some the booking details yeah like this one yeah you just refer the registration page please fill all details for booking first name address pin code contact number and book okay so see this code is the error free code just need to change the sum IDs so this is the edit text full name but that full name is the lab book lab test book so I am just add here LTB ltp lab test book full name lab test book address lab test book PIN code lab test book contact and this is the book button button booking LTV yeah LTB booking or book yeah code is error free okay fine now uh just check the code actually yeah just uh refer the registration page add four edit texting one button okay this is simple design and now I am going to the lab test book activity uh so here I'm going to use the four edit text and two one button and one button button BTN booking yeah this is the mapping edit text LTB full name LTB address LTB contact LTB PIN code and one more mapping is that the button button LTB booking yeah uh we have already passed some data from the previous activity previous activities the checkout activity lab test uh yeah card lab activity and here we just passed the price date and time so for that we need to uh get the sum data with the help of intent object okay so we get the price okay divide that colon because here we pass the string is a total cost colon one four nine seven so we divide the string into the colon character speed that string and we get the first index uh parameter so store that in a store that price in this price variable and this is the date and this is the time okay then need to write the uh event of booking so BTN booking dot set on click listener new yeah first we get the username uh using the shared preferences okay shared preference object get the username then need to create the object of database okay and there is uh need to create a one more table that the order table actually so they need to pass the add order function and remove all the data from that cart if all the data is successfully saved in order table okay then after that we just pass a one toast message like your booking is done successfully and redirected to the home activity page so we need to write the we have already write the remove cart remote card function in database so all the lab data need to remove from that card okay so see again in database we have already write the Remo card okay so delete and this is the where condition where username equal to question mark and O type equal to lab just need to write a one more function the order functions okay so for that we just uh create a one more table order place and these are the some basic detail username full name address contact number PIN code date time amount and O type O type is just for the lab okay yeah when we try to create a new table just uh need to remove this database table from that database yeah so when we when we create the object of this database then on that time that database is created and all with all these three tables are created okay then after that uh we we just write a one more function like the add order function and add order function which is pass we just get all the data by parameter so which data like username full name address contact pin code is in integer then date time price and O type this content value we just put all this data step by step this is gate writable object and insert a data into the order replace table close okay yeah so just rerun the application so I'm just removing the database uh with the help of this device file explorer section so need to register new user again yeah so username is Nilesh password is one two three register yeah let's login that user okay uh in lab test first we need to add some some package in a cart so I'm just going to add package number five add to cart package number two add to cart go to cart these two package are added total cost is 998 and just select the time date is that the 30 or the second November and the delivery time just for the approximate like 1050 yeah okay and check out yeah so I'm just passing here the full name this is the sum booking detail address is the grocery pin code is okay and this is some dummy contact number one two three four five six okay yeah and hook your booking is done successfully need to check need to check that booking is done successfully or not uh with the help of this order detail page yeah right so first we need to get all the order data so for that we need to write to one more function in a database dot Java file okay so here I'm just going to write one more function get order data so see again in add order so these are the some parameters okay and check it again in a in a card lab I think uh uh lab test book here that error is remove add order the first parameter is username second one is that the edname deck dot get text.2 stream address dot get test dot two string then the contact dot get text.2 stream then this is the integer dot parsaint because the PIN code is in integerator type so see date dot two string time.2 stream uh casting the float and we get the price one here we split in split with the help of colon yeah with the help of colon so zeroth index is the string total cost and first index is actual amount so this is a casting and the last one is order type is that the lab okay uh yeah I also need to check the all the data from that Labs card card data remote node so lab test go to cart all the card data is removed successfully so these two functionalities are parallely work remove all card data and insert that data into the order table okay yeah now I'm going to write the functionality of order details for that we need to create one new activity so first we're going to the home activity and in that home activity uh I'm just going to add up one event of this order detail card yeah card View and Order details card name is that the order details set on click listener and that redirected to the order detail activity okay I think one section is pending need to write here the one ah yeah that section uh here we just copy one function get order data and just need to pass the username okay so get all the order data including lab medicine or anything okay so we get all this data so this gate order data string username and just create a one blank arraylist object readable and the query select start from order place where username equal to question mark and this is the if condition this is do y so array dot add okay so get all the data from that order and be concat with the help of dollar symbol okay you have option actually except dollar you choose any any special characters actually because uh because there are the multiple columns and we need to uh concatenate all the columns into one screen and add into the array once all the data is get in that the activity page then we split that data into the separate variables and display properly yeah so this is the function we need to call that function in a order page okay so in that home activity we need to create the new activity order details activity so right click new activity is the empty activity order details activity finish yeah for that activity uh there is one background image and there are the two text view one list View and the one back button only four components are in there okay so check in design section this is a simple design okay so see here 24x7 order details this is the list and this is the back button only these four components are in here uh card View Title in OD order detail Okay order detail title title T capital refactor this is the list View OD order detail yeah and the back button button OD back order detail back button yeah check that code is error free yes yeah okay uh now going to here Order details activity page and first we map all this data we just create a declare some variables there is some list so that's why hash map address and simple adapters so that data is required this is the string not Doctor Detail this is the order details yeah uh there is one list list View LST okay uh button back button yeah vtn so do your mapping BTN equal to button button button OD back button yeah then LST equal to list view OD uh okay I think these two things is very important and here we just use a event for the button when we click on back button redirected to the home activity then uh need to create the object of database then shared preferences and released yeah database object Healthcare shared preferences get the username and uh here get order data and we did we get all the data and store it in an arraylist now that data is in a concatenated string uh with the dollar sign so need to split that string and store into this string array order details string array okay so for that I'm just going to write here the one for Loop and we just replace the string all these things are order details yeah so see here Order details zeroth index then the first index second third four five all these data are stored in order details in in five columns okay five columns okay because we just map to five columns to this again multiline dot XML layout now after that need to create the list object okay and this is again order details map all these five data to this line and after that create the simple adapter object okay uh LST .setup because we have already mapped this LST here list view OD yeah and display all this data in this list adapter so rerun this application and check it the order details for this lab order details see this is the one order details border type Bosley rupees uh delivery date and time we just can't get these two things in in one one text this is the lab see here Del 4 and 5. date and time just concat and store into this third index and the lap okay yeah here we are using the one condition actually if the O type is that the medicine because in medicine I think we don't require the time so on that period we just store delivery date okay so time is not required on that uh type of order so so that's why here we are using one condition so medicine sections are in pending yeah okay uh back okay goodbye medicine now we just need to write the functionality or do the code for the by medicine most of the uh flow are very similar to that lab test because except the packages we need to display all the medicine list when we click on that any medicine display the medicine detail and medicine cost there is one more add to cart button go to card button and also there is checkout button so most of the functionality are very similar okay but we are not using the same activity uh here we are not reusing that activity uh we have option actually we we have option to reuse that activity but this is uh just a student beginning project so that's why in biomedicine we create a separate activity okay and just reuse or copy paste the lab code in that medicine section so first in home activity home activity for the buy medicine need to create a activity biomedicine activity okay my medicine card biomedicine copy new activity empty activity by medicine activity finish okay okay so uh biomedicine activity is very similar to the lab okay so I'm just set a one background color sorry background image and just copy paste the code text view deliver location 24x7 Healthcare this is the least view button back button by medicine and go to card button check it in design section uh buy medicine just change the title text View BM by medicine title refactor this is the list View BM by medicine go to cart go to cart button go to cart BM buy medicine go to card button yeah back button BM by medicine back button yeah the design is ready we just rerun this application and check it that page is redirected to that biomedicine card or not one two three login Yeah by medicine successfully redirected okay so need to display here some medicine detail okay so for that I'm just going to create a some medicine medicine names and some medicine details okay I'm just copying uh this this is a hard coded actually these are the submitted scene I have just uh just make a Google and just copy some medicine name and some description of that the medicine so uh that the string number two three four are empty because we are reusing this multiline.xml layout again okay so these three sections are empty this is the medicine cost of uh the per per unit yep per group cost actually uh maybe 10 capsule or five capsule or 15 capsule yeah so these are the some uh three six three four five six seven eight nine capsules actually and these are some descriptions okay yeah so this is the hard coded data you have option or you just modify this code and make uh more tables in database like face the data and make a one admin login and in that admin login admin have option to add medicines add the more lab package details so that is affected to users okay yeah you have option to do that after this completing this application yeah after that I'm just declaring some variables hashmap arraylist simple adapter there is one list View one back button uh one go to card button button back button button go to cart good then here we do the mapping LST equal to find view by ID r dot ID dot list View BM by medicine BTN back equal to find view by ID r dot ID Dot button [Music] um button VM back go to card yeah so need to write the back functionality uh card by medicine activity I think this is not the back uh yeah yeah this is actually go to card functionality I'm just comment this code yeah and uh for that back back button this is the back button they redirect it to the home activity yeah good again we need to create the object of least yeah get the package detail and stored in a line one two three four five variables which is a total cost again need to create the object of simple adapter okay and we just map these five lines to this multi-line five variable and display it in a list View okay so check it again rerun yeah this is the medicine so when we click on that any medicine we just display some medicine details okay so for that I am just adding the event of that LST so LST set on item click listener when we click on that item redirect it to the new activity by medicine detail activity like lab details okay and we pass the medicine name total cost and medicine name medicine detail and total cost you pass all this data from this one activity to another activity yeah for that we need to create this new activity by medicine activity so copy new activity empty activity by medicine detail activity yeah finish yeah so this is very similar to lab test detail activity right so I'm going to the code set some background okay and the code is similar to the lab test details so this is a package name delivery location Pune 24x7 Healthcare application name add to cart button back button this is a multi-line text and this is a text View yeah going to the design section see here again takes you for the I think this is the Maybe cost actually medicine cost yeah so check it again biomedicine is the package name but we need to change the package name here buy medicine details so bmd okay edit text multiline by medicine detail total cost by medicine detail add to cart button but this is a biomedicine detail add to cart button and the back button back yeah refactoring all this code so code is error free and all the IDS new IDs are set here good so in this buy medicine detail activity okay when we are coming to this activity uh first we get the data from that intent and display display in a text view okay so for that we need to just declare these two variables we have a two text View and one edit text so just rename that the text view so first one is that the TV package name this is the TV um multi-line text not multi-line this is TV or total cost this is a ed multi-line Ed I'm just passing as a package uh AV details this is the package details section okay and map all these data package name text View bmd package name bmd total cost foreign multi-line yeah button two buttons BTN back BTN add to cart BTN back button bmd back to card okay then we just want to get the data from that intent okay text one text to text three and uh first one is that the package name so set the package name data second one is that the multi-line details so Ed details third one is that the total cost so set the total cost and here we disable the editing feature of that uh edit text okay then [Music] back button write the function into a back button BTN back redirect it to again a biomedicine activity previous activity okay yeah and when we click on that add to cart add to cart is the event actually need to create the object of that the new in new entity uh just removing this line yeah when we click on that the add to cart just need to pass the username price product name okay so for that username you just get the username for the shared preferences get the username then we get the product price details so product is the this is the package name is the product name okay and the text 3 is the total cost and we need to cast that amount into the float okay need to create the ddb database object database object Healthcare is the database and we use the same if else condition we have already used in a lab test yeah first need to check that product is already in card if that product is already in a card then show product already added otherwise I think not required to create one more object of the database otherwise we add this product into cart with username product price and the O type is that the medicine now last time the O type is that the lab and messages that record inserted to cart you start this activity and redirect it to the my medicine activity again okay so this code is very similar to the um lab test details okay so save rerun this application and check it again login by medicine uh when we click on the dollar 65 tab this is the description total cost 30 rupees add to card record inserted into the card you need to add one more add two cards so these two products are in a cart second thing is that we need to write the functionality of a go to cart button when we click on that go to cart we need to redirect to the another activity okay so I think um [Music] yeah here add to cart uh now you need to go to the buy medicine activity here and when we click on that go to card button we need to create a new activity card biomedicine activity this is a card actually and this cart is similar to the lab test card okay so copy create new activity card cart by medicine yeah again this code is similar to the cart lab test okay so code set the one background image [Music] and just copy everything from that uh card by medicine cart lab yeah copy paste here so this is the design section and the lower location is Pune lab test and package text view car title yeah there are two cards I'm just add here this card is the biomedicine so BM card VM card title then this is a BM card text View by medicine card buy medicine cart list View biomedicine card title by medicine cart total cost then only need to the delivery date not for the time so I'm just removing the time section yeah and yeah select the date that date is that the delivery date actually change the message select the deliver date this is the date [Music] um date ID BM BM card check out BM card checkout back BM card back yeah okay check the code is error free [Music] so cart by medicine yeah like uh just add a cat lab activity and just copy all these things copy paste so date time button are the all these buttons are same then these are the mapping forward mapping just need to add [Music] button BM card buy medicine cart date there is no time section all right BM card back BM card total cost list ubm card okay okay fine then set preference database package everything is same from here just copy the date picker function yeah and for that back button or a back button uh this is the current activity cart by medicine activity dot this and redirect to the biomedicine activity actually not a lab test right biomedicine activity and when we check out check out then again we redirected to the by by medicine actually this is a new activity biomedicine book activity okay need to create that activity I'm just comment out this code okay uh then check it again here shared preference object username then database object then get the data get the car data of O type is that the medicine right yeah this is the package data then this is for Loop split data find the cost yeah find the total amount set that amount in the total okay then the list adapter yeah back button and this is a checkout button actually yeah this is time yeah okay card biomedicine activity just need to this uh display all the cards so rerun this application and check it again [Music] so by medicine go to cart so these two items are added in a cart back just check for a lab Lab package 3 add to cart go to card package 3 is in a lab card card section and buy medicine card section having a two medicine details so these two sections are in different because of the O type here O type is medicine and their O type is that the lamp this is the total amount 160 and this is the delivery date 27 or we have option to change that titles okay fine so uh everything is okay just need to uncomment this thing yeah need to create a one more activity buy medicine book activity this way you need to book that medicine like the lab booking activity okay so create a new activity as a empty activity biomedicine book activity okay foreign booking set one background image yeah need to set some IDs package name text view buy medicine book by medicine book BMB full name edit text full name address PIN code contact number book yeah so going to the biomedicine book activity this is very similar to the lab test book activity okay so I am just using copying this all sections yeah edit text edit text by medicine biomedicine book BMB full name so BMB MB address contact pin code and button booking okay then copy all these other things okay uh yeah we get the username yeah get the data price date and the time I think uh there is no time right no time from that the this is the biomedicine book activity current activity so lab test booking biomedicine cart by medicine just passed price and the date yeah there is no time price and the date then this is the booking listener shared preference get the username then create the database object okay then after that we use the same function add order everything is in same just pass the lab is the medicine okay these are the medicine orders medicine uh price one uh there is no time string right so for that I am just past the empty string okay yeah uh everything is looking good then remove card remove card from again medicine or type medicine your booking is done successfully redirected to the home activity okay okay so yeah save and check it again rerun this application login by medicine go to the card these two products are in a cart we chose the delivery date is that the 29 check out yeah these are the some details I'm just field some some details here okay uh book yeah booking is done successfully and when you go to the order detail see these are the two orders one is for lab and other is for the medicine yeah I think that two sections are successfully done lab test okay go to cart back back order details is also done there is only delivery date no time back yeah uh biomedicine is also done okay I think there is one section in spending for the fine doctor when we choose the a new doctor and when we these are the four details doctor name Hospital address mobile number and consultant fees and booking appointment booking date appointment booking time book appointment I think everything section is same as our order columns see here in this database just the column is the different actually so username full name username is the login username this is the full name so instead of this full name we just pass the doctor name this is the address then this is the mobile number then amount is also there date time is also there okay and o type we just passed over type is that the maybe a booking appointment okay so we have options to reuse the same order table order place table for that book appointment section also so that section is in pending actually book appointment button event is pending so we are going to that again activity page uh book appointment and this is the uh event button okay yeah so in that section in that book apartment first we uh create the object of that database here database then we we want to get the username uh with the help of shared preferences yeah uh one more thing is that we just check that on the same date and same time is that any appointment is there okay if already is that there is some appointment okay check appointment exist we just need to check the appointment is exist or not for that we just need to pass the username then the title equal to full name address contact and the other things time is also date time okay and we just check that this is equal to equal to one so for that we need to write a one function in in database section like the check appointment exist or not so in the database section we just need to write one more function check that appointment is exist or not this is the one function so parameter are the username full name address contact date time so we just take that that username or that things if you have already exists in that appointment section so pass all this data and check your select star from order place because we have we will use the order place table for that appointment section also or if if you don't want to reuse you just create a one new table for that book appointment and where the here we check the username is question mark full name address and everything here we have to check just check that the same user or that same doctor and and same doctor and the same user on that same date and time okay so book this appointment or not so for that just return the result equal to 1. okay yeah so check it again here we just pass all the data DB dot check appointment exist so we pass the username and here we pass the title equal to full name address contact uh then date button then time button and here we have to match it is these are all the options are equal to equal to one okay if all the options are one means that appointment already booked otherwise we use the same add order function we have already done yeah and pass the username that that title section has a full name uh we don't have any pin code so pass the PIN code 0 uh then pass the date time then amount and type is that the appointment okay yeah and just passed your appointment is done successfully and redirected to the home activity.class yeah so save rerun this application now Nilesh then at one two three login find doctor yeah and choose this doctor on the tomorrow 28 on timing 10 book appointment your appointment is done successfully check the order details this is the family physician doctor named Prasad power Hospital address weekly rupees 908 time appointment yeah so appointment medicine lab all these three sections we have handled in one database table okay yeah so I think lab medicine find Doctor orders or just four section and also lockout section is also we have done right only one section is pending health articles and that section is not a big task actually because we just passed uh one ready made images to that health article page but for that we need to create a one activity and redirect it to the health article activity page so I am going to the home activity and here just write a one card Health doctor and redirected to the health article activity dot class so going to create new activity empty activity yeah finish okay so for that health article pass the background is that the back one the there are two text view one list View and one back button simple design okay one text view health articles 24x7 Healthcare one list View and one back button so in design section see here this is the simple design yeah uh 24x7 this is the logo health article this is a title actually I'm just pass here the title is that [Music] um health article h a title right then this is a list view list view h a health article then this is the back button button back health article h a yeah so save all these changes now health article dot Java this is our file um foreign there are a different health articles we have a total of five articles walking daily home care of Code 9 stop smoking yeah and these are the these are click more details actually these are the sections and uh uh there are total five images we have that images in drawable directory see in a drawable directory Health one two three four five okay so we just create a one integer array okay then we declared adapter I released hash map arraylist simple adapter okay then for that back button uh need to create the two buttons and I have one button actually BTN back yeah uh redirected to the home activity yeah then um we get the data and uh map to the line one two three four five okay create the simple adapter object okay uh this is 50 here [Music] um where to map actually here mapping is missing actually uh list to LST yeah list View health article BTN back find view by ID button health article back yeah and lst.set adapter essay and one more thing is that when we click on that listener okay when we click on that list item we redirected to the another new activity health article detail activity and just pass the image as well as a health article titles okay so I'm going to create this activity also new activity empty activity yeah this is a new activity finish health article details and here we just display a one image okay so set one background and there is one text view heading a back button one image okay so text View uh I'm just past the default text is the dentist this is the 24x7 health here back button and this is the one image View okay so need to change yeah for initially we just pass a one hardcoded one image this one and that image is the Health one okay this is just default image actually yeah for the dentist we just passed that the title the health article detail title had okay title then this is the one image image View health article detail this is the back button button health article detail back button yeah so that section is ready and uh we need to get all the data from that intent in this health article detail activity okay and just display that data into the text view as well as image View so here one object is text view one is that the image View so first we map this data yeah so this button back button back is the health article detail back button yeah you need to set the button also BTN Bank then mapping of these two things one is text view one is the image View text View health article detail title image view hid okay so get the data from that intent and set the title to this pv1 and for that image we just need to create the object of bundle okay because this is the dynamic image and we get the data image data uh from that the intent object and we we get the integer from the text to and set the image resource with that ID Iris ID and need to write the back button code so for that back button uh again redirected to the activity health article activity yeah so good yeah uh just rerun this application login yeah health article these are total five articles click more details click yeah stop smoking the smoking image back yeah these are the some just I have downloaded that images from Google okay yeah it's just for a testing purpose okay now the project is ready okay so I'm just create a new user and show you the all the all those functionality in step by step so I'm just log out okay register for new user register the new user Raul at 123 Rahul at one two three okay register record inserted now here login are it's small I think yeah login yeah Auto Detail there is no order details back uh this is the health article walking daily yeah Home Care okay then lab test these are the some different packages click on the second package this is the description add to cart record inserted this is the package 5 add to cart okay so two items are added are added in a card when you click on the go to card these two items are in a cart total is 990 we select it till your date set the time okay okay and check out just fill the detail book your booking is done successfully order detail this is the lab detail okay back for the buy medicine we just choose we have different images different medicines actually just add this image medicine actually we have added total three Okay click on the go to cart these are the three medicine this is the total six one nine uh choose the delivery date okay check out fill some details like this is the email ID yeah book yeah booking is done check the order details medicine booking is done actually okay then in back uh find doctors these are the different doctors surgeon okay if you want to book an appointment of any doctor these are the all the doctor details and editing options are disabled to each edit text so select the date select the time book appointment yeah appointment is done successfully check the order details the surgeon doctor books successfully back and log out okay so that uh just this is this is just the beginning project actually Android project so I hope you understand uh that coding technique or everything and you have option actually to modify that project like uh we have used all the package detailed medicine detail hard coded right so you have option to make it dynamic create a database tables one admin login user so on on on admin have options to add or modify the medicine details lab details also the find doctor's details okay uh this is just a beginning project so I hope you understand so please like And subscribe this Channel and see you on next video okay so bye bye take care