Make a Weather App for Android | Android Studio | Kotlin

  Рет қаралды 104,466

Coding With Evan

Coding With Evan

Күн бұрын

How to make a weather app using kotlin for android. This is a simple weather app using weather API.
API: openweathermap...
Images: drive.google.c...
Source Code: github.com/eva...
Join our Facebook Group : / codingcom
Our Facebook : / codingwithevan
Our Instagram : / codingwithevan
------------------------------------------
Music Credit: Lakeyinspired
Soundcloud: / lakeyinspired
------------------------------------------

Пікірлер: 146
@CodingWithEvan
@CodingWithEvan 3 жыл бұрын
To get the API key: Login to openweathermap then goto "My API Keys" under your profile name. There you will find your API key.
@harshit5803
@harshit5803 3 жыл бұрын
This is java or kotlin based?
@قناةالرياضيات-ن7ر
@قناةالرياضيات-ن7ر 3 жыл бұрын
@@harshit5803 kotlin you can see the class end with (.kt)
@itz_frost7038
@itz_frost7038 3 жыл бұрын
@Coding With Evan Im getting while using readText to get text from the URL result .Can you help me with that
@aldogiovanni7606
@aldogiovanni7606 3 жыл бұрын
@@itz_frost7038 could you resolve that? I'm there but I can't continue 😥
@itz_frost7038
@itz_frost7038 3 жыл бұрын
@@aldogiovanni7606 Have not got that yet
@meetpatel3426
@meetpatel3426 3 жыл бұрын
Why you not use one constraint layout rather then lots of layouts ?
@ygor-camila
@ygor-camila 2 жыл бұрын
Because He's Senior and He know how create app more quickly...
@MohsenMashkour
@MohsenMashkour Жыл бұрын
because the layout will be more responsive. if you use a single constraint layout, in different screen sizes the view will be destroyed.
@GabrielVieira-yn1nu
@GabrielVieira-yn1nu 2 жыл бұрын
Thank you Evan, it was really helpful for me!
@diegoarmandoescalonavasque152
@diegoarmandoescalonavasque152 18 күн бұрын
what development environment program?
@SachinGuy
@SachinGuy Жыл бұрын
The async task seems to be depricated any other way to implement this?
@GarryWhitworth
@GarryWhitworth 2 жыл бұрын
Evan, this tutorial was excellent and by far one of the better ones I have I have seen. I liked especially that it was a short videos, it worked and that it tied together Android UI, HTTP Calls and simple JSON processing. Thanks ! ++
@hellosolverstore
@hellosolverstore 3 жыл бұрын
Brother in my case it shows error on weatherTask.execute() I think execute deprecated in api 30 What to do solve this pls tell brother....
@anglesmithtechnology3030
@anglesmithtechnology3030 2 жыл бұрын
also getting same error
@filokalos2001
@filokalos2001 Жыл бұрын
Thank you very much. Very clear. Excellent explanation, step by step. Thank you for sharing your knowledge.
@shivamkumartiwari6545
@shivamkumartiwari6545 3 жыл бұрын
Kotlin is made only for android apps or for something else also ?
@CodingWithEvan
@CodingWithEvan 3 жыл бұрын
Kotlin was invented to solve developer challenges of JetBrains. They needed a simpler tool than Java to work with IntelliJ IDEA. in 2017 Google announced Kotlin as official language for Android development.
@fahrenalfaqih8173
@fahrenalfaqih8173 9 ай бұрын
thanks a lot evan my project absolutely doneeee
@ridj41
@ridj41 2 жыл бұрын
Hey bro, it takes a lot of time to load on my Emulator as well on my phone. It just keeps on loading and doesn't open.
@Instantcrypt
@Instantcrypt 3 жыл бұрын
sir, my app is run successfully but don't show result in display
@iftak01
@iftak01 3 жыл бұрын
Yes Dhaka, BD. Nice Evan!
@sumitsuryawanshi9060
@sumitsuryawanshi9060 3 жыл бұрын
keep building projects Evan brother
@zakariyedaauud5527
@zakariyedaauud5527 3 жыл бұрын
I wanted to see the project you built first from the beginning
@Fkglt_
@Fkglt_ 2 жыл бұрын
This is for only one city ? how we can check weather by trun on location?please help
@tasdidalam3247
@tasdidalam3247 3 жыл бұрын
Need more videos with big project e commerce project with explaination
@loubi.abdessalam
@loubi.abdessalam Жыл бұрын
HI BRO , IF YOU CAN CREATE A NEW VEDIO FOR MAKING A CONSULTATION APP ,THATS SO GOOD
@mohammadsiefaddeenkh.abual8982
@mohammadsiefaddeenkh.abual8982 8 ай бұрын
Sir, the app in my case always showing the location US, what seems to be the problem ?
@_thesiddhukadam
@_thesiddhukadam 3 жыл бұрын
What kind of gui u have used??
@enricosavegnago
@enricosavegnago 3 жыл бұрын
Could you explain also how to create a form to insert the location?
@CodingWithEvan
@CodingWithEvan 3 жыл бұрын
You can create e SearchView and then get the city name and call the weatherTask() inside the onquerylistener of that view.
@devmuca9269
@devmuca9269 2 жыл бұрын
@@CodingWithEvan Hi, could you help me? I can't make this form with just an EditTex and a Button? can you explain it to me please, because I couldn't with SearchView
@devmuca9269
@devmuca9269 2 жыл бұрын
@@CodingWithEvan it can leave! I managed to do it with an editText in a new activity, the person puts the name of the city/state, and the app gives the weather for her, thanks for the video❤️
@HijaTS
@HijaTS 2 жыл бұрын
​@@devmuca9269 Hi, can you help me, how you solve this(I mean I know, just don't know to write it, I'am beginner) that a person puts the name of the city? Can you send me a code? I'll be very appreciate to you
@deepsheth1086
@deepsheth1086 2 жыл бұрын
sir can you tell me which library we have used here for Api call?
@MohsenMashkour
@MohsenMashkour Жыл бұрын
no library is used.
@clo4k661
@clo4k661 3 жыл бұрын
vai apni to bangladeshi, ekta question chilo, apni kotlin kivabe sikhsen? kono course or onno kisu? karon ami ei field e new tai guidelines pete problem hocche, ektu bolle valo hoto. TIA
@CodingWithEvan
@CodingWithEvan 3 жыл бұрын
Mainly java diye start korsilam android development. Pore udacity er ekta kotlin course korechilam.
@clo4k661
@clo4k661 3 жыл бұрын
@@CodingWithEvan oh thanks via
@LifeEchoWhispers
@LifeEchoWhispers 2 жыл бұрын
Since I am new to android studio I just wonder why do coders usualy create so many layouts inside layouts to create an app, can it be done with 1 layout ? can you explain me this please. Thank you btw great video
@antoniocld
@antoniocld 2 жыл бұрын
To keep separation of concern's also called business logical to make refactor easy.
@MohsenMashkour
@MohsenMashkour Жыл бұрын
because the layout will be more responsive. if you use a single constraint layout, in different screen sizes the view will be destroyed.
@mfahad24
@mfahad24 2 жыл бұрын
Man, instead of music, you gotta talk through what you are doing. The building of all those nested xml was tough to follow.
@CodingWithEvan
@CodingWithEvan 2 жыл бұрын
Yes buddy, this was one of my first videos. My recent videos have a full voiceover.
@mfahad24
@mfahad24 2 жыл бұрын
@@CodingWithEvan thanks again! Good stuff here
@henrychan1973
@henrychan1973 3 жыл бұрын
Thx for the video. it help me for the assignment
@derekorodu8223
@derekorodu8223 3 жыл бұрын
Hi. Without my logic, my UI shows perfectly. But once I add all the logic, everything disappears except for my background. What could be the cause? Also, instead of relative layout, I used constraint layout to design my UI.. Could that be the issue?
@anshuraj8430
@anshuraj8430 3 жыл бұрын
Hey! I'm also facing the same problem. Were you able to solve that?
@derekorodu8223
@derekorodu8223 3 жыл бұрын
@@anshuraj8430 Yeah. I made a mistake with my UI. My progress bar and error message textview were both inside the main container. Once I removed them, the UI worked well.
@anshuraj8430
@anshuraj8430 3 жыл бұрын
@@derekorodu8223 oh okay! I'm getting the same error again and again . Everytime it's just displaying "something went wrong".
@derekorodu8223
@derekorodu8223 3 жыл бұрын
@@anshuraj8430 Hmm maybe you made a mistake in one of the tags of your json object calls.. I also made that mistake too.
@anshuraj8430
@anshuraj8430 3 жыл бұрын
@@derekorodu8223 okay , I'll check once with that. Thank you!
@sarcastic_hi6526
@sarcastic_hi6526 Жыл бұрын
hey i want to change the city name ...when im changing and running the app it shows something went wrong can anyone tell me the correct way to change the city name
@balajikashyap3935
@balajikashyap3935 Жыл бұрын
I am getting an error where it's saying android resource linking failed... can someone help me please..?
@aakritithakur359
@aakritithakur359 3 жыл бұрын
Can you explain in brief how you created the API key?
@CodingWithEvan
@CodingWithEvan 3 жыл бұрын
Login to openweathermap then goto "My API Keys" under your profile name. There you will find your API key.
@aakritithakur359
@aakritithakur359 3 жыл бұрын
@@CodingWithEvan got it thanks
@aakritithakur359
@aakritithakur359 3 жыл бұрын
@@CodingWithEvan hey, great code but it contains Async task class which is depricated in the current version of Android Studio. Can you try making the app using Kotlin coroutines?
@aakritithakur359
@aakritithakur359 3 жыл бұрын
@@CodingWithEvan I tried the code but the app is crashing. Can you help?
@aakritithakur359
@aakritithakur359 3 жыл бұрын
this is the main activity kotlin file package com.aakriti.weatherly import android.os.AsyncTask import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.ProgressBar import android.widget.RelativeLayout import android.widget.TextView import org.json.JSONObject import java.net.URL import java.text.SimpleDateFormat import java.util.* class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) weatherTask().execute() } inner class weatherTask(): AsyncTask() { override fun onPreExecute() { super.onPreExecute() findViewById(R.id.loader).visibility= View.VISIBLE findViewById(R.id.mainContainer).visibility=View.GONE findViewById(R.id.errorText).visibility=View.GONE } override fun doInBackground(vararg p0: String?): String? { return try{ URL("api.openweathermap.org/data/2.5/weather?q=Delhi,in&appid=784ed1b20a4a811f957c1b649791650b").readText(Charsets.UTF_8) } catch (e:Exception){ null } } override fun onPostExecute(result: String) { super.onPostExecute(result) try{ val jsonObj= JSONObject(result) val main=jsonObj.getJSONObject("main") val sys=jsonObj.getJSONObject("sys") val wind=jsonObj.getJSONObject("wind") val weather=jsonObj.getJSONArray("weather").getJSONObject(0) val updatedAt:Long=jsonObj.getLong("dt") val updatedAtText="Updated at: "+SimpleDateFormat("dd/MM/yyy hh:mm a", Locale.ENGLISH).format(Date(updatedAt*1000)) val temp=main.getString("temp")+"°C" val tempMin="Min Temp: "+main.getString("tempMin")+"°C" val tempMax="Min Temp: "+main.getString("tempMax")+"°C" val pressure=main.getString("pressure") val humidity=main.getString("humidity") val sunrise:Long=sys.getLong("sunrise") val sunset:Long=sys.getLong("sunset") val windSpeed=wind.getString("speed") val weatherDescription=weather.getString("description") val address=jsonObj.getString("name")+", "+sys.getString("country") findViewById(R.id.txtAddress).text=address findViewById(R.id.txtUpdatedAt).text=updatedAtText findViewById(R.id.txtStatus).text=weatherDescription.capitalize() findViewById(R.id.temp).text=temp findViewById(R.id.tempMin).text=tempMin findViewById(R.id.tempMax).text=tempMax findViewById(R.id.sunrise).text=SimpleDateFormat("hh:mm a",Locale.ENGLISH).format(Date(sunrise*1000)) findViewById(R.id.sunset).text=SimpleDateFormat("hh:mm a",Locale.ENGLISH).format(Date(sunset*1000)) findViewById(R.id.wind).text=windSpeed findViewById(R.id.pressure).text=pressure findViewById(R.id.humidity).text=humidity findViewById(R.id.loader).visibility= View.GONE findViewById(R.id.mainContainer).visibility=View.VISIBLE } catch (e:Exception){ findViewById(R.id.loader).visibility= View.GONE findViewById(R.id.errorText).visibility=View.VISIBLE } } } }
@JerrysTechCorner
@JerrysTechCorner 3 жыл бұрын
Thanks sir! I managed to build the app!
@ahsanrazasumayari8503
@ahsanrazasumayari8503 3 жыл бұрын
when I write val CITY: String it becomes red ?? error tell me solution
@liamweeks3898
@liamweeks3898 3 жыл бұрын
Try: lateinit var CITY: String Why: There are two types of variable types in Kotlin, val and var. Val cannot be reassigned to another value. If you say, for example: val name = "Joe" you will not because to give another name. On the other hand, var can be modified. If you say: var name = "Joe" you can later reassign it like this: name = "Mike" Why I am telling you this is because you haven't actually declared the variable type yet. You can't just assign the type of a val type variable without giving it an actual value. Hope this helps.
@nonetoro
@nonetoro 3 жыл бұрын
TRY val city = "London, UK"
@afanter4314
@afanter4314 Жыл бұрын
I dont know why i cant seem to get my text to become white
@imthegamer9874
@imthegamer9874 Жыл бұрын
Very good video👍
@syahidbaddry3009
@syahidbaddry3009 2 жыл бұрын
how do you know the name from wind or main,when you do getstring(how do you know this exact name?)
@CodingWithEvan
@CodingWithEvan 2 жыл бұрын
It's written in the api documentation. If you visit openweathermap website
@syahidbaddry3009
@syahidbaddry3009 2 жыл бұрын
@@CodingWithEvan so every api has document how to use it?im sorry im still new with api
@yourneighbourhoodclownwith8490
@yourneighbourhoodclownwith8490 3 жыл бұрын
i am getting an error , org.gradle.api.GradleException Do you have any idea what is causing it?
@yourneighbourhoodclownwith8490
@yourneighbourhoodclownwith8490 3 жыл бұрын
Hey , if we want to find the weather of places other than dhaka it works right?
@CodingWithEvan
@CodingWithEvan 3 жыл бұрын
Yes it will work.
@yourneighbourhoodclownwith8490
@yourneighbourhoodclownwith8490 3 жыл бұрын
@@CodingWithEvan i am getting an error , org.gradle.api.GradleException Do you have any idea what is causing it?
@llarux
@llarux 2 жыл бұрын
hey Even the tutorial was amazing!!. but I have a problem my screen keep showing the error text (Something went wrong) even after I did the internet permission how can I solve it? please help
@roxtarguna6067
@roxtarguna6067 2 жыл бұрын
getting the same problem did you find the solution
@llarux
@llarux 2 жыл бұрын
@@roxtarguna6067 I found the problem I wrote description with an I :) (discreption)
@llarux
@llarux Жыл бұрын
@@madhukarjadhav3767 yes my problem was a Misspelling in a word so make sure you wrote every word in the right way
@llarux
@llarux Жыл бұрын
@@madhukarjadhav3767 then I don’t know what’s the problem sorry
@jakeedwards4642
@jakeedwards4642 Жыл бұрын
For me the issue was that I had an incorrectly formatted CITY string so the api call wasn't resolving, then our catch statement is set up to display the error text when the api call fails. Try setting the city to something like "London,GB" and see if that fixes the issue.
@shivamkumartiwari6545
@shivamkumartiwari6545 3 жыл бұрын
And also please tell me how to deploy this app on Google Play Store ?
@reinaldoriantkurniaperdana4670
@reinaldoriantkurniaperdana4670 3 жыл бұрын
developer.android.com/studio/publish/upload-bundle follow this one
@andresbonilla1367
@andresbonilla1367 3 жыл бұрын
Wonderful video! Thanks :)
@jubibi390
@jubibi390 3 күн бұрын
implementation starts from 12:24
@meetpatel3426
@meetpatel3426 3 жыл бұрын
Sir why max temp and min temp are same ?
@pujithalakshmisetty2791
@pujithalakshmisetty2791 2 жыл бұрын
How to take user input for city name ?
@katarina_8898
@katarina_8898 2 жыл бұрын
For some reason, the application does not work. The message "Something went wrong" appears. Could it be because I'm from Russia?
@CodingWithEvan
@CodingWithEvan 2 жыл бұрын
Check if you have added internet permission.
@llarux
@llarux 2 жыл бұрын
@@CodingWithEvan I have the same problem as her and I added internet permission but still get the error text
@whites4769
@whites4769 Жыл бұрын
@@madhukarjadhav3767 did you got the output ?
@whites4769
@whites4769 Жыл бұрын
@@madhukarjadhav3767 please drop ur github url or twitter url
@s.devadathan4476
@s.devadathan4476 3 жыл бұрын
Hey Evan, I am getting an error like : must use 'apptint' instead of 'androidtint' What should I do?
@apl4s
@apl4s Жыл бұрын
Use it like this app:tint="#FFFFFF"
@punitmaru5
@punitmaru5 3 жыл бұрын
Which app is used for making project
@divyanshudivyanshu8224
@divyanshudivyanshu8224 2 жыл бұрын
Tiktok
@belgin9674
@belgin9674 3 жыл бұрын
is this layout responsive sir?
@mayrafernandacamachorodrig6638
@mayrafernandacamachorodrig6638 2 жыл бұрын
te quiero mucho, muchas gracias dios, te bendiga a ti, a toda tu familia y a quienes quieran a ti y a tu familia un saludote y un abrazo muy pero muy cordial desde mi queridisimo México.
@facebooker212
@facebooker212 2 жыл бұрын
bendiciones
@amankr.prasad2537
@amankr.prasad2537 3 жыл бұрын
Time not changing??
@zakariyedaauud5527
@zakariyedaauud5527 3 жыл бұрын
And what program do you use in pythone or another
@AbulHasan-h4r
@AbulHasan-h4r 3 ай бұрын
java
@pradeeprajput9439
@pradeeprajput9439 3 жыл бұрын
Error found in Messaging View
@ameyayadav9084
@ameyayadav9084 3 жыл бұрын
help bro weatherapplication(28134) [DEAD]
@ameyayadav9084
@ameyayadav9084 3 жыл бұрын
when i click on the app it shut downs error : com.example.weatherapplication(28134) [DEAD]
@whites4769
@whites4769 Жыл бұрын
something went wrong is the output please help !
@whites4769
@whites4769 Жыл бұрын
capitalize(): String' is deprecated. Use replaceFirstChar instead. Implicitly using the default locale is a common source of bugs: Use capitalize(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault(). Implicitly using the default locale is a common source of bugs: Use capitalize(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault(). -capitalize- underlined please help evan !
@h.r.60
@h.r.60 3 жыл бұрын
somebody knows his stuff 👌
@prateekchauhan4087
@prateekchauhan4087 3 жыл бұрын
My app is not working can you help mee .?
@CodingWithEvan
@CodingWithEvan 3 жыл бұрын
Sure. Whats the issue?
@عباسشاهين-ف7ع
@عباسشاهين-ف7ع 3 жыл бұрын
Very very very good
@vaibhavratan4908
@vaibhavratan4908 3 жыл бұрын
is this app fixed for one location or it changes locations?
@basicallyjat
@basicallyjat Жыл бұрын
KINDLY DON'T TRY IT NOW. IT DOESN'T WORK ANYMORE . SAVE YOUR TIME AND TRY ANY OTHER TUTORIAL
@vibhavsachan743
@vibhavsachan743 Жыл бұрын
why?
@basicallyjat
@basicallyjat Жыл бұрын
@@vibhavsachan743 depreciated methods
@shehrozarshad9857
@shehrozarshad9857 Жыл бұрын
This is this helpfull
@Raghu-wy3ry
@Raghu-wy3ry 3 жыл бұрын
Develop all your apps in kotlin
@ETERNALxJOD
@ETERNALxJOD 11 ай бұрын
Sir please give code so i can copy🙃🙃
@durveshbodkar929
@durveshbodkar929 2 жыл бұрын
i want it using java'
@ztjoker3260
@ztjoker3260 Жыл бұрын
Thank yooou😘
@isharadulanjla1137
@isharadulanjla1137 3 жыл бұрын
Hardcoded... 🙁
@banglatutorialltd.9415
@banglatutorialltd.9415 3 жыл бұрын
ও ভাই আপনি বাংলাদেশী?
@CodingWithEvan
@CodingWithEvan 3 жыл бұрын
হ ভাই
@ahsanrazasumayari8503
@ahsanrazasumayari8503 3 жыл бұрын
?
@debdeepsengupta7532
@debdeepsengupta7532 3 жыл бұрын
My app is also not working
@debdeepsengupta7532
@debdeepsengupta7532 3 жыл бұрын
Even if I give internet permission it's showing something went wrong
@prathmeshbonde9555
@prathmeshbonde9555 3 жыл бұрын
@@debdeepsengupta7532 same
@music4kinds239
@music4kinds239 2 жыл бұрын
@@debdeepsengupta7532 did you solve that?If yes could you say how?
@music4kinds239
@music4kinds239 2 жыл бұрын
@@prathmeshbonde9555 did you solve that?If yes could you say how?
@mehdi.3601
@mehdi.3601 2 жыл бұрын
Me tooo
@bloxxiq
@bloxxiq Жыл бұрын
When i open android srudio
@hellosolverstore
@hellosolverstore 3 жыл бұрын
Brother in my case it shows error on weatherTask.execute() I think execute deprecated in api 30 What to do solve this pls tell brother....
@farihazultana
@farihazultana Жыл бұрын
same
Make an Image Compressor App | Android Project | Full Tutorial
38:56
Coding With Evan
Рет қаралды 17 М.
Is Our World Broken?
11:40
Kurzgesagt – In a Nutshell
Рет қаралды 2 МЛН
Which One Is The Best - From Small To Giant #katebrush #shorts
00:17
Spongebob ate Michael Jackson 😱 #meme #spongebob #gmod
00:14
Mr. LoLo
Рет қаралды 11 МЛН
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 132 МЛН
Retrofit in Android Studio using Kotlin | Android Knowledge
19:05
Android Knowledge
Рет қаралды 7 М.
We Built an App in 24 Hours [No Code]
11:56
Raw Startup
Рет қаралды 434 М.
The Weather App in Jetpack Compose using Kotlin | Android Knowledge
32:32
Android Knowledge
Рет қаралды 1,6 М.
Learn Kotlin in 12 Minutes
12:01
Rahul Pandey
Рет қаралды 329 М.
Calculator App Android Studio Kotlin Tutorial
12:22
Code With Cal
Рет қаралды 78 М.