Android food recipes app tutorial using retrofit|mvvm|edamam|api #10

 

#Edamam #Retrofit #Android #Food #MVVM #API

This is a series of video tutorials in which we are going to create an android recipes application that will allow us to search over 2 million recipes online using Android Studio, Retrofit, and Edamam API'S website. Get up to date with the latest video upload by turning on the notification bell icon from this channel.

REQUIREMENTS: --Java JDK --Android Studio --Retrofit library --Background knowledge of Java language

Hello everyone welcome back again to tutorial number 10 of our android retrofit application series so in case you are just new to this video so please be sure to watch the previous video so you will not get lost around so for this uh project uh going to create a recipe application if you are interested to learn how you can create a complete application based bi so you can place and I would encourage you to the very first video so until the last video so you can really have complete knowledge on how you are going to use the retrofit library to create the API application so without saying too much let's get back to the android studio so this is where we left off from the previous video created the interface so this will allow us to make using the query that we have provided in the constructor of this is so this will be sent to this to the online web server which is basically it is the edemam.com and then we are trying to retrieve the JSON of from this

server so the next class that we did is the credentials so where we stored the uh base url uh the stream so the types and the id and the api key so this is what we have done in the previous video so if you're just a new viewer to this video I would like to encourage you to watch the videos from my front display you will not get lost around from this tutorial so uh in this tutorial what we are going to do will be we need to continue working on the search recipes because we have not yet completed so this class will this will uh be sent to the server so because we are passing it to this interface to the retrofit call passing it as a parameter so this will be sent to the server so what we are going to define in this class will be since we are going to get the data from this object from the JSON object if we want to get the number of the result we can also include this one into this the search response class by clearing an integer so in case that we'd like to

also, the value for these for this attribute so we can also include it so we can go and declare and after that we can if we go to the JSON object since we are going to display the result the recipes into an array so you see here we have an array of recipes so it is displaying multiple results based on the search query of the user so for example now so this should just this should display the result of every recipe that has account recipes so what we are going to do so we can get the array of recipes so we can uh let me just get back here and we can declare a private uh root model but with a generic array so you can name it recipes or just before recipes and then after that, you need to serialize the name is not the same in the JSON object so we need to actually because it is we can serialize it we can make it okay we can symbolize it so

heats if you remember we already defined the recipes here inside of this class so this parent class declared a class inside of this search recipes class so and we need and since we are going to return the value as an array so the array of recipes remember that is a recipe an array so an array that has an object so we are going to create since we are going to return all! right we need to serialize it by hits then we can just write expose okay other because it has the same name as the JSON that we have okay so we don't need to put a serialized name because taking it so the next thing to do with it we need to create getters to this field so we need to select all now we are now generating the getters and once we do that we can also create a publish string recipes will be equal to the full piece and so we can just actually return the front, okay there is a piece is okay just under the process okay so undo this one okay guy we also need to add the recipes the name will be recipes, yes the result is in the console so yeah plus string now we are almost getting finished. to finish this tutorial guys so if you learned something within this video so please consider subscribing to the channel to support my content also if you enjoy this video please hit the like button if you have some questions write them in the comment so other people can see it also and thanks for watching guys so I hope to see you in the next videos bye for now.


Post a Comment

0 Comments