Kotlin Youtube - How to Quickly Fetch Parse JSON with OkHttp and Gson (Ep 2)

  Рет қаралды 85,967

Lets Build That App

Lets Build That App

6 жыл бұрын

Episode 1: • Kotlin KZfaq: Intro ...
Today, we learn how to fetch JSON data and integrate it using Model objects in our application. What's going to make our lives a lot easier is to use the help of OkHttp and Gson to fetch and parse our objects. Once we construct a HomeFeed model containing a list of videos, we will modify MainAdapter to dynamically render our list using this REST api endpoint. Enjoy.
HomeFeed Json Endpoint: api.letsbuildthatapp.com/yout...
OkHttp: square.github.io/okhttp/
Gson: guides.codepath.com/android/l...
Intermediate Training Core Data
www.letsbuildthatapp.com/cour...
Instagram Firebase Course
www.letsbuildthatapp.com/cour...
Facebook Group
/ 1240636442694543
iOS Basic Training Course
www.letsbuildthatapp.com/basi...
Completed Source Code
www.letsbuildthatapp.com/cour...
Follow me on Twitter: / buildthatapp

Пікірлер: 203
@samthexplorer9621
@samthexplorer9621 6 жыл бұрын
Your systematic approach to programming and explanations make your vidz worth watching. Thanks Brian!
@dcdales
@dcdales 4 жыл бұрын
In case anyone is having the problem I had - in the build.gradle file, if you write what Brian wrote ("compile..."), it'll show up with a line crossed through it. If you hover your mouse over that text, it'll tell you that "compile is deprecated, replace with implementation" - so you basically just replace the keyword. I would've figured this out sooner if I'd known to hover over that text, haha! Awesome videos, Mr. Voon! 10/10! Thank you!
@heathkornblum6007
@heathkornblum6007 4 жыл бұрын
Brian has a casual, easy demeanor that makes him a good instructor. I recommend this video.
@cotswoldconversions
@cotswoldconversions 3 жыл бұрын
3 years later, still a life saver. Clear and concise, also great demo of 'Debug' too 👍
@vinaynagrani7954
@vinaynagrani7954 6 жыл бұрын
After watching your tutorials, it feels so comfortable to start with Android development using Kotlin. Thanks Brian!
@absconditus8660
@absconditus8660 5 жыл бұрын
You're so chill. I feel like I could smoke a blunt with you and talk about various code syntaxes.
@LucasLima-yu8mb
@LucasLima-yu8mb 6 жыл бұрын
How can someone dislike this master piece? Thanks bro, those libs to work with Json and HttpRequest are really, really great! Youre a beast!
@souphiane10
@souphiane10 3 жыл бұрын
This video helpt me A LOT! I have a deadline and don't have the luxury to dive into the documentation. Thanks for explaining this so easily!
@rodiaz2709
@rodiaz2709 2 жыл бұрын
Thank you. I had like 3 hours trying to parse a JSON from an API and thanks to you I was able to do it. Not only that, but I think I actually understand the process and will be able to repeat it in the near future. Gracias.
@smag21
@smag21 3 жыл бұрын
Amazing tutorial. Watched countless other tutorials and none of them told me to add the internet permission in the manifest, hence my errors. You made this very clear and simple to understand. Thank you!
@iantassin7611
@iantassin7611 5 ай бұрын
Took me so long to find a decent tutorial on this! Thank you! Great video and explanations!
@emmanuelpregnolato5026
@emmanuelpregnolato5026 6 жыл бұрын
Been following your through iOS and now Kotlin. You have a gift for teaching.
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Glad to have you follow the channel, isn't great that we can program in so many languages?
@uzKantHarrison
@uzKantHarrison 6 жыл бұрын
Hey, I'm really lucky I found you. Your videos are too good, really. I really needed something practical yet super clear in order to build my application for a uni course in about 15 days without knowing kotlin at all (I refused to use java, I really dislike it).
@surjavaghosh427
@surjavaghosh427 5 жыл бұрын
Thank you so much for all your hard work :) When ever I want to learn something new.. your videos are always what I need . Please keep it up
@ravi_dhorajiya
@ravi_dhorajiya 6 жыл бұрын
I Love these tutorials, Easy to understand and very helpful videos.
@albaqawi
@albaqawi 6 жыл бұрын
Hay Brain, thank you for a magical outstanding experience to get me back on a fast track for mobile development. I am very grateful to come across someone who loves to grow through sharing knowledge like you. I am loving this Kotlin track even through my heart is set on iOS :D I want to take the opportunity to wish you and all your loved ones a brilliant holiday season and more success and prosperity in the new year.
@shingiraibondai747
@shingiraibondai747 6 жыл бұрын
i wish you could get a million views. Thank u so much, this is very easy to follow
@cvdogan
@cvdogan 6 жыл бұрын
You have taught me Obj C first. Then Swift. And now Kotlin. I think I owe you a drink :D
@kerem.a14
@kerem.a14 4 жыл бұрын
adamın heykelini yapsak taşaklara beton yetmez
@roiiroii9561
@roiiroii9561 3 жыл бұрын
I applied for a job 1 week ago and this was my sort of task to get an interview. Basically if i am going to be accepted on this internship it's going to be just because of you Thank you
@charleskinniburgh7206
@charleskinniburgh7206 6 жыл бұрын
Very nicely presented. Just right for a tutorial.
@rogerwprice
@rogerwprice 6 жыл бұрын
Loving it!
@venusianoctopus1
@venusianoctopus1 6 жыл бұрын
Great videos! Thank you so much. :)
@hyejinahn2898
@hyejinahn2898 6 жыл бұрын
Thanks for the tutorial !! :D
@vivekrai5042
@vivekrai5042 6 жыл бұрын
Hey Dude you are doing great job. Thank-you for the videos.
@abdulazeez180
@abdulazeez180 3 жыл бұрын
Thank you !!! , you just saved me in my 400 level class
@JohanAlbrectsen
@JohanAlbrectsen 6 жыл бұрын
I LOVE these Android tutorials
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Everything's nice and easy eh?
@JohanAlbrectsen
@JohanAlbrectsen 6 жыл бұрын
Lets Build That App I really like that you compared some of the elements to the corespondent elements in swift. Makes it easier, please keep doing that :-) But yeah, some concepts I can’t understand 100%
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
After you get over the initial "new syntax" scare, it becomes the same thing but in a new language. Good ol fetch json, load images. Rinse and repeat.
@benyaminaghaebrahimi5073
@benyaminaghaebrahimi5073 6 жыл бұрын
same as always, very helpful, thank you
@joycelu962
@joycelu962 6 жыл бұрын
SOOOO grateful!! Thanks!!!
@truongnguyenthe6492
@truongnguyenthe6492 2 жыл бұрын
love your work your video , thanks alot
@sf2759
@sf2759 6 жыл бұрын
UR VIDEOS ARE SUPERB!
@hyperspace5828
@hyperspace5828 5 жыл бұрын
I love you dude, you save my life
@lilashsah6225
@lilashsah6225 6 жыл бұрын
thank you very much.This video is very help full for me
@AbhishekKumar-mq1tt
@AbhishekKumar-mq1tt 6 жыл бұрын
Thank u for this awesome video
@evertonrodrigues1277
@evertonrodrigues1277 4 жыл бұрын
For everyone having trouble with Gson not parsing array, if your Json starts with a "[", make sure to use YourClass. Also, if it starts as an array, the example that he have using the HomeFeed class won't work, you would need to use the Video class directly. Watch out for the format of your Json.
@EdgarG2310
@EdgarG2310 4 жыл бұрын
could you please send an example of the code? and how can I change the format of my Json?
@matheusserraouchoa8222
@matheusserraouchoa8222 3 жыл бұрын
owesome video is symple and just go in what we need thankssss a lot ps:from a brasilian fan
@waichee723
@waichee723 5 жыл бұрын
Thanks your video are awesome.
@yersultanutemissov
@yersultanutemissov 6 жыл бұрын
man, nice job
@TravelMemories
@TravelMemories 5 жыл бұрын
hi man, i have a question, i am doing this with maps, but i dont know how call the mainthread on response, to reload the map when the points are loaded, something like layoutViews or something
@hispagamers
@hispagamers 4 жыл бұрын
thanks profesor brian
@GistTech
@GistTech 6 жыл бұрын
Hello, How do you tackle the case whereby the user has no active internet connection?
@donathmm3881
@donathmm3881 2 жыл бұрын
Thank you bro
@artemkonoplin2143
@artemkonoplin2143 6 жыл бұрын
Hi! Thank you for the video. Do you use x86 or arm emulator?
@imranahmedtech843
@imranahmedtech843 6 жыл бұрын
Love You Bro
@mrrice4036
@mrrice4036 6 жыл бұрын
Thank you so much . bro 😊😊
@pembatamang8233
@pembatamang8233 6 жыл бұрын
let the beginners know that the list is meant for the jsonarray and the world isn't over... it took me hours to figure that out. that aside your tuts are very helpful
@boeingpete
@boeingpete 4 жыл бұрын
Me too. Took a little while to work out what was going on there.
@joredawal2297
@joredawal2297 6 жыл бұрын
sir.. are the lessons/tuts that the link you've provided below is for free.? or if isn't how can i enrolled in your class on android dev. especially on kotlin courses..
@philwatkinson5417
@philwatkinson5417 5 жыл бұрын
These are great videos, thanks Brian. There's a minor syntax change with the latest Android Studio/Kotlin libraries: At the 10:42 point in the video, the syntax is: override fun onResponse(call: Call, response: Response) It seems to be no practical difference, but Kotlin insists that the declaration of an overridden function is EXACTLY the same as the abstract declaration.. .. Aah, there's another small syntax change on the next line, it should be: val body = response.body?.string() Cheers.
@MasPran
@MasPran 4 жыл бұрын
thank you very much, I'm studying this. in this section, I found an error in the code that I tried from the tutorial. I read read a few comments. I found the answer here ... I am very happy ...
@sayanmanna2511
@sayanmanna2511 3 жыл бұрын
Dude u r a savior!
@aviksutar
@aviksutar 6 жыл бұрын
very nice
@VinitJogani
@VinitJogani 6 жыл бұрын
The videos are really great. I just wanted to point one thing out - I guess we can also make HTTP calls in a more simple way: using threading and the URL library, it boils down to one line: Thread({ val response = URL("").readText() }).start()! You still need to use Gson to convert it into a model, but I found this to be the easier way...
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Hmm....really? I gotta brush up on the Threading library.
@VinitJogani
@VinitJogani 6 жыл бұрын
Yeah! I discovered it a few days ago myself. And it's much simpler with Kotlin than it was in Java. The one downside though is that you do have to use try-catch statements as the inbuilt URL library throws a fatal exception when it can't read a url...
@ivicapetrsoric1263
@ivicapetrsoric1263 6 жыл бұрын
Could you please post the code with your solution?
@VinitJogani
@VinitJogani 6 жыл бұрын
Hey, like I said. The code is just this much: Thread({ val json = URL("").readText(); val object = Gson().fromJson(json); runOnUiThread({ // do something with the object... }); }).start();
@sraldous
@sraldous 6 жыл бұрын
Should the homeFeed & Video classes be 'data class' rather than just 'class'?
@kanhaiyatulsyan7560
@kanhaiyatulsyan7560 3 жыл бұрын
yes that would been have a better approach....!!!!
@developerios6096
@developerios6096 5 жыл бұрын
Hi brian, this a great video! Im an iOS developer, and im writing my first kolin lines. I like to write code like i would do with swift, so i created a network manager class to fetch the json. All is fine, however, i dont know how to return this data to my main activity. In swift i would do this with a completion block on the the fetchJson(), but i dont know if there is something similar in kotlin. Also, intercepting the adapter from my network manager class, is something i want to avoid because its not the purpose of this class to update the UI with the new data. How do i return data properly?
@utsabsubedi6009
@utsabsubedi6009 5 жыл бұрын
Only the original thread that created a view hierarchy can touch its views. how to solve this in fragment? you cannot use runOnUiThread on fragment
@roothack2325
@roothack2325 6 жыл бұрын
Hi, I need your help. I have a live portal with database how can I convert into an Android app
@jshamuraq
@jshamuraq 4 жыл бұрын
Is there gonna be tutorial for populating recyclerview from, say, an xml file within the product package instead of loading it from the internet?
@anasabubakar4125
@anasabubakar4125 6 жыл бұрын
nice tutotials
@guillermoyeltsinbaltodanol5548
@guillermoyeltsinbaltodanol5548 6 жыл бұрын
First...!!!! Good video, keep it up ... !!!
@haasithsanka5706
@haasithsanka5706 5 жыл бұрын
There's an error inside of runonuithread because I'm getting that homefeed is null inside the runonuithread
@tylerrutt17
@tylerrutt17 6 жыл бұрын
Thanks! Very helpful!. Just wondering if you have any tips for refreshing yourself with Xcode? Like if you've taken a break from it for awhile.
@context177
@context177 5 жыл бұрын
Hi, Brian! Awesome videos, best way to get job in software dev field is DO DEV!:) Could you make a video explaining how to use RPC. Can't find answers for json-rpc2.0 using Kotlin. THX!!!
@RahulSharma-es9uv
@RahulSharma-es9uv 4 жыл бұрын
Retrofit vs okhttp? Which one shall we prefer
@dumitru3355
@dumitru3355 5 жыл бұрын
Thanks )
@trainmania100
@trainmania100 3 жыл бұрын
In 2021, is okhttp and gson still the recommended thing to use to build something like this?
@LetsBuildThatApp
@LetsBuildThatApp 3 жыл бұрын
Google their github activity
@sraldous
@sraldous 6 жыл бұрын
Quick side question, how do we set custom colors when using API 15? Everything I'm trying seems to require API 26. Thanks!
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
What have you tried?
@sraldous
@sraldous 6 жыл бұрын
Color.argb requires API level 26 However, I found Color.parseColor("#HexValue") to work, is this the only option?
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Yep, i've used parseColor in the past. Is there a reason you're not using targetSdkVersion 26? My configurations use: minSdkVersion 15 targetSdkVersion 26
@carbon4061
@carbon4061 5 жыл бұрын
hey. i have a question. if i go another activity and still need the same data what should i do. is there a way to make "val homeFeed" accessible frown any Activity ?
@LetsBuildThatApp
@LetsBuildThatApp 5 жыл бұрын
We go over this in the next lessons right? I might be going crazy after reading comments
@raoufrahiche2828
@raoufrahiche2828 6 жыл бұрын
thnks
@mheymans
@mheymans 5 жыл бұрын
Just a quick note to watch out for. This took me about an hour to realize. Don't use body = response?.body()?.toString() use: response?.body()?.string() ResponseBody has its own to string function - string()
@adrianalarsson7345
@adrianalarsson7345 4 жыл бұрын
Do you fixed the problem?
@7erg95
@7erg95 4 жыл бұрын
body() is deprecated, use body like variable instead it
@ethanhatch9224
@ethanhatch9224 3 жыл бұрын
My debugger is telling me that I am getting NULL values in my class when converting Json to Gson in: val homeFeed = gson.fromJson(body, HomeFeed::class.java) I can't seem to figure out why or how I can mitigate this. (I am using my own variable names and a different API)
@billyopiyo566
@billyopiyo566 5 жыл бұрын
Can Anyone help me cause I am having errors in my thread.java file yet i didnt even edit it@android 3.3
@williamclarkson6834
@williamclarkson6834 4 жыл бұрын
I'm getting an error when using fetchJson, "E/zygote: isWhitelistProcess - Process is Whitelisted. Does anyone know how to get around this? I'm using my Samsung S7 as my emulator, its never given me this error before. Any help appreciated!!!
@nanditaekambaram9609
@nanditaekambaram9609 4 жыл бұрын
My code moves to the onFailure function call and gives me an error "System.out: socket failed: EPERM (Operation not permitted)"
@marshal7969
@marshal7969 4 жыл бұрын
mine too, idk why
@BuildezCraft
@BuildezCraft 4 жыл бұрын
@@marshal7969 Delete the app from the emulator and run again
@vpsaxman
@vpsaxman 3 жыл бұрын
@@BuildezCraft that worked for me, thanks!
@gtbgmaniak
@gtbgmaniak 5 жыл бұрын
Hello Brian, That's an excellent tutorial. I am implementing it, I did have some differences in the structure (my JSON was an array instead of an object, but I found out how to fix that. I am having another problem though, I am using this code inside a fragment and when I try to use the runOnUiThread { } block, it's marked as red and it's not working, any idea how I could fix that?
@andreaculot99
@andreaculot99 5 жыл бұрын
Excuse me, could you tell my how you fix your first problem? I’m new to Kotlin and also my JSON is an array...
@gtbgmaniak
@gtbgmaniak 5 жыл бұрын
@@andreaculot99 hello, sorry for the late answer, I ended up switching libraries to RetroFit2 and it worked like a charm :) almost didn't have to change code.
@aviksutar
@aviksutar 6 жыл бұрын
make some tutorial on augmented reality in Android.Ur tutorials are awesome
@valeria-210
@valeria-210 6 жыл бұрын
Brian, I did a navigationButton with three items. I visualize (as you do to check) that each fragment is shown when selecting each item. My query is, to apply your course to a fragment, is it the same? What if it was an activity? or with a fragment does the programming change?
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Each fragment should be its own entity. Once you load one, loading a second one is pretty easy.
@valeria-210
@valeria-210 6 жыл бұрын
I do not realize how to do it ...? Will you have a tutorial or do you know any guides? THANK YOU!
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Google pretty much shows you how to load a fragment right?
@valeria-210
@valeria-210 6 жыл бұрын
yes, until the fragment shows up, and upload a text manually, too, I have the problem in showing the data from the json ....
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
You should probably load the json then, no?
@philwatkinson5417
@philwatkinson5417 5 жыл бұрын
If you get an OkHttpCliient error "failed to execute request" here's what to try: (*) Double-check the url is correct - it's "api." not "www." (*) Add the following line to the onFailure function to give more details in the logcat about the error: Log.i("LBTA", e.message) (*) Test your OkHttpClient code by using a different JSON feed: This is a public testing feed that I used: url = "jsonplaceholder.typicode.com/posts" If you see some json in your logcat, then you know your code is okay, and that the problem lies with the server. Hope this helps.
@MeAndAdiZero
@MeAndAdiZero 5 жыл бұрын
If the error message in the logcat is something like socket failed: eperm (operation not permitted), you can also try uninstalling the app from the emulator and debugging it once again.
@Tom-rk3xl
@Tom-rk3xl 5 жыл бұрын
Hello ! I am having a big problem. When I compile, the function prints out what is written when onFailure but not when onResponse. how to fix it? I tried other .json files but still the same
@Tom-rk3xl
@Tom-rk3xl 5 жыл бұрын
I found the problem :D it is because your phone is sleeping.. :D unlock it and then compile :D
@sawkhinmaungthoo5063
@sawkhinmaungthoo5063 6 жыл бұрын
I just wanna say "i will click a lots of ads on your tutorials" !!!!!!
@vanillasrecaps6022
@vanillasrecaps6022 4 жыл бұрын
Hey I tried changing my url to my localhost one and it suddenly don't work , can anyone help me?
@i3lacangel
@i3lacangel 5 жыл бұрын
Hey, great tutorial... But having lots of trouble with API links that have parameters
@sandroh3378
@sandroh3378 6 жыл бұрын
Hi Brian, The video is really helpful. I just wanted to ask a question how can I use OkHttp with request method POST in Kotlin? Thanks
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
I'd go ahead and use the method shown here for POST requests: stackoverflow.com/questions/23456488/how-to-use-okhttp-to-make-a-post-request
@sandroh3378
@sandroh3378 6 жыл бұрын
Great. Thank you so much
@carloselilopeztellez7802
@carloselilopeztellez7802 5 жыл бұрын
Is it a better practice to keep models in separate files?
@LetsBuildThatApp
@LetsBuildThatApp 5 жыл бұрын
Probably, why do you ask?
@tohaassegaf7642
@tohaassegaf7642 4 жыл бұрын
sorry for asking, why my api always Failed to execute request, i'll try to use your api anda another api. but it still not working properly
@adrianalarsson7345
@adrianalarsson7345 4 жыл бұрын
Need help too
@adrianalarsson7345
@adrianalarsson7345 4 жыл бұрын
I get the answer in the console but the homefeed class dosent show
@jackh3824
@jackh3824 6 жыл бұрын
Im getting this error when using a different url to parse an array. "Expected BEGIN_OBJECT but was BEGIN_ARRAY" Is there a simple fix? Ive altered all my classes to to adhere to the new url. Changing the home feed class to "Array" instead of "List" gives the same error. Im coming from iOS so I figure there has to a simple solution.
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Episode 5 of this series explains how you would parse an Array of objects instead of an Object directly. Namely, you need to use Array::class.java.
@jackh3824
@jackh3824 6 жыл бұрын
You're really making the sub worth it. 👍🏽
@thanasisathanasi4965
@thanasisathanasi4965 4 жыл бұрын
What is different of Gson and Volley?
@mahirchowdhury4448
@mahirchowdhury4448 3 жыл бұрын
I love you
@christophebeaulieu4916
@christophebeaulieu4916 3 жыл бұрын
The videos are great, but I feel like your microphone might be slightly not loud enough? I'm comparison to other videos, this one is probably at 70-90% volume whereas I listen to others at like 40-50%. Anyways, the content and the videos are amazing! :)
@drjones694
@drjones694 6 жыл бұрын
if you install android studio fresh and when you run the okhttp it is not working make sure your emulator can reach the internet. to test hit home on the emulator and click chrome go to yahoo.com. if it doesnt work go to android studio preferences ( on a mac ) and type in proxy make sure the android studio is using the current wifi connection then go to the emulator and make sure the proxy tab says to use android studio test yahoo.com again and your all set. hope that helps anyone new and having issues
@sherazali6324
@sherazali6324 5 жыл бұрын
How you have created this api I mean if using sql then on what server or is it heroku?? Your information mean a lot. Thanks :)
@aym_zahid
@aym_zahid 5 жыл бұрын
i have the same problem
@LearnWebDesign
@LearnWebDesign 5 жыл бұрын
I know this is an older comment - and wanted to write something just in case someone read it in the future and had the same question. Depending on your language determines how you generate your data - the API is just JSON nothing more, nothing less. Converting your objects to a json object should be simple, search "your language data to json" should give you some insight -- now I will say -- make sure your data is not in a parent array - I had this break on me -- meaning your data starts like this [....] vs {} - best of luck.
@RussellHarrower
@RussellHarrower 3 жыл бұрын
Ok besides that OkHttp now allowing .execute().use which works - I could not get your method to work.
@ameysaple7893
@ameysaple7893 6 жыл бұрын
Can you show dynamic horizontal recyclerview to dynamic vertical recyclerview with jain parse...pls
@qwithonly7967
@qwithonly7967 5 жыл бұрын
when i call fetchJson. it always return onFailure. is anyone know what happen?
@cerdek9190
@cerdek9190 5 жыл бұрын
i have the same problem, do you know what happend?
@Tom-rk3xl
@Tom-rk3xl 5 жыл бұрын
i found the problem :D it is because the phone is sleeping . unlock it and then compile ;D
@sirisaac8727
@sirisaac8727 5 жыл бұрын
@@cerdek9190 Have you found a solution?
@drumagazine5722
@drumagazine5722 3 жыл бұрын
Why don't you use retrofit to parse the data
@anasabubakar4125
@anasabubakar4125 6 жыл бұрын
iam hoping you will make Android development courses as you did for ios development
@franciscosuralopez
@franciscosuralopez 5 жыл бұрын
Hi! I'm new in this world of Kotlin, and i want to ask you if there is a new way to do this? Cause I've been trying with your expample, the same way, but i cant make the app work. Hope you answer me. Best regards.
@LetsBuildThatApp
@LetsBuildThatApp 5 жыл бұрын
Did you download the sample project and run using link in description?
@franciscosuralopez
@franciscosuralopez 5 жыл бұрын
@@LetsBuildThatApp yes i did it, but i couldnt run it!
@LetsBuildThatApp
@LetsBuildThatApp 5 жыл бұрын
Why not?
@franciscosuralopez
@franciscosuralopez 5 жыл бұрын
@@LetsBuildThatApp it gave me so many errors at compile that i couldnt run it!
@LetsBuildThatApp
@LetsBuildThatApp 5 жыл бұрын
What kind of errors?
@mbfauzan
@mbfauzan 3 жыл бұрын
Hi, nice tutorial, how do i change the url ?
@diymicha4905
@diymicha4905 4 жыл бұрын
Why can I only fetch from https? If I use your url "api.letsbuildthatapp.com/youtube/home_feed" it works like a charm, and displays the raw json data. But if I'm using my own json on my server (which is not https) it fails. My json comes from an http server, so the app gives the "failed to execute" error... But the syntax of my json is exactly the same. :( I now tried volley, I tried retrofit, now OkHttp (which is the easyest and most logical in my opinion) but all with the same result. It seems like android refuses to connect to http. But it has to work somehow...
@LetsBuildThatApp
@LetsBuildThatApp 4 жыл бұрын
Http doesn’t work fyi
@sf2759
@sf2759 6 жыл бұрын
Please do reply... is there a proplem in storing a big json from a real estate api..like hundreds of proporties..in a string for parsing. Do u lose info? Please do reply!!
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Yes, its called a database. You can use a free setup called Firebase. I have lessons on this in the description below with the Instagram Firebase course.
@sf2759
@sf2759 6 жыл бұрын
Bryan thanks for the reply, but what i meant was thati'm fetching 100s of pages worth of json from a third party real estate api, so im lot allowed to store the data.But is there a probem if i fetch it and store in one string variable for parsing??is it the righy way?
@typical_punjabi_munda
@typical_punjabi_munda 4 жыл бұрын
very good !! can you please tell me how to parse json array instead of json object ???
@mohitajwani
@mohitajwani 6 жыл бұрын
Hey Brian, the Endpoint is not working and always returning failure. Please check below error message. javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Can you visit the endpoint on a browser and verify that SSL is properly configured?
@mohitajwani
@mohitajwani 6 жыл бұрын
Brian, if I use a browser I get the response. But, it doesn't work when we make the API call from the emulator as shown in the video. Can you please check if open access is allowed?
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
It's because the emulator sometimes doesn't know how to resolve SSL certs, it's an ongoing issue that doesn't have a real workaround. You can use the same endpoint but "http" instead of "https", just make sure you use https on production apps, or launch on a real device instead.
@mohitajwani
@mohitajwani 6 жыл бұрын
Thanks a lot Brian for the prompt responses. Will check and get back to you.
@mohitajwani
@mohitajwani 6 жыл бұрын
Hey Brian, Thanks for the tip. I verified this on a device and it works fine.
@philwatkinson5417
@philwatkinson5417 5 жыл бұрын
Thanks for the really great videos, Brian. I'm getting this error from the OkHttpClient: "Trust anchor for certificate path not found". Mr Google indicates that the SSL certificate on the server has expired or is mis-configured. These videos are well over a year old now and you don't have any responsibility to maintain them, but the context is still relevant and there are thousands of beginner developers (like me) that would get a lot of benefit out of them. So I hope this is something that is easily fixable. Cheers.
@philwatkinson5417
@philwatkinson5417 5 жыл бұрын
Brian, apologies; I've found a solution. I was implementing a logging interceptor (an useful exercise in itself) and accidentally tested the project against a different virtual device in the emulator - and got a different INET exception (what?!). A bit of trial and error I found a virtual device that would make the project accept the api feed - Nexus 9 Android 7.0 (API 24). Weird. Having seen some advice that a good way to eliminate strange errors is to close the emulator and reopen it, I feel that I have bumped into one of those dark and mysterious areas of Android programming - and feeling a little bruised and humbled as a result, Apologies again.
@roberthdg
@roberthdg 4 жыл бұрын
@@philwatkinson5417 you've saved me hours of trial an error, thanks
@ahmedkhairi2259
@ahmedkhairi2259 6 жыл бұрын
in my code onFailure() get called instead of onResponse() the internet is working fine, some Help please
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
Are you hitting the same url as in the video?
@LetsBuildThatApp
@LetsBuildThatApp 6 жыл бұрын
By the way, you can print out the failure message onFailure to see what the error is.
@ahmedkhairi2259
@ahmedkhairi2259 6 жыл бұрын
the problem was in the url thanks B
Kotlin YouTube - Load and Cache Images Picasso (Ep 3)
25:42
Lets Build That App
Рет қаралды 22 М.
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 91 МЛН
CHOCKY MILK.. 🤣 #shorts
00:20
Savage Vlogs
Рет қаралды 13 МЛН
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Бискас
Рет қаралды 5 МЛН
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 29 МЛН
Kotlin YouTube: Intro to RecyclerView (Ep 1)
26:03
Lets Build That App
Рет қаралды 86 М.
What is a REST API?
9:12
IBM Technology
Рет қаралды 1,5 МЛН
Android Kotlin YouTube: Pass Data Between Activity through Intent (Ep 5)
20:07
Android Kotlin: Introduction to Android Studio and FizzBuzz
21:29
Lets Build That App
Рет қаралды 52 М.
Introduction to HTTP/REST - Android Basics in Kotlin
10:27
Android Developers
Рет қаралды 52 М.
Why The Windows Phone Failed
24:08
Apple Explained
Рет қаралды 233 М.
Github - You Can View Deleted Private Fork Data
23:40
ThePrimeTime
Рет қаралды 51 М.
Android Kotlin: Essentials to Creating a ListView (Ep 1)
20:20
Lets Build That App
Рет қаралды 94 М.
I tried 5 Firebase alternatives
10:31
Fireship
Рет қаралды 774 М.
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 91 МЛН