TOASTS AND CONTEXT - Android Fundamentals

TOASTS AND CONTEXT - Android Fundamentals

Philipp Lackner

4 года назад

36,530 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Diparshan
Diparshan - 19.11.2023 18:17

i have having trouble with the custom toast. When i try to create view in line 18, it doesnt allows me to select the root id and there a dash in the view text aswell. i think its probably cause of version or that this method is deprecated. What should i do for this?

Ответить
Daniel Adamiak
Daniel Adamiak - 18.11.2023 20:05

nice

Ответить
Bill Molloy
Bill Molloy - 17.10.2023 22:35

Ответить
Colby Downs
Colby Downs - 21.09.2023 07:44

Hey Philipp, I think the layoutInflater has undergone some changes in recent years. The custom toast portion of this video doesn't appear to work anymore if coded in Android today. I'm currently working through the playlist. I expect some hiccups from a 3 year old series... just wanted you to know. Thanks!

Ответить
walid aguib
walid aguib - 23.07.2023 13:53

hi Philipp , why you do not use Relative Layout ?

Ответить
Kelly Malaki
Kelly Malaki - 02.06.2023 10:17

Even though it looks pretty shitty😂😂😂

Ответить
Tessanix
Tessanix - 22.04.2023 04:46

Mr Poop has the bast name ever

Ответить
Abhinab Sahoo
Abhinab Sahoo - 09.04.2023 15:53

How are you able to use btnShowToast.setOnClickListener directly without even findiViewById or viewBinding??

Ответить
Astaghfirullahalzim Astaghfirullahalzim
Astaghfirullahalzim Astaghfirullahalzim - 05.03.2023 15:03

just realises that for any given user defined class that takes in `Context` instance as argument to it's constructor, we cannot declare our instance of such classes as property of an AppCompatActivity. Usually we have MainActivity inherits from AppCompatActivity. But then we cannot declare our "user defined"
class as property of MainActivity. Because it contains `Context` object but at this point the `Context` object is still not initialised by the JVM or Android..if we instantiate it inside one of the callback functions(e.g onCreate()) that define the lifetime of our instance and variables than here if we pass this@MainActivity to the "user defined" class's constructor then it will work. If we pass too early we will get `NullPointerException`

Ответить
Tosin Rotimidokun
Tosin Rotimidokun - 20.02.2023 23:17

Some processes in this video are deprecated. If you want to complete a custom toast, see my code:

class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
private var customToastView: View? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//bind your parent xml layout with view binding
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

//inflate your custom toast xml file
customToastView = layoutInflater.inflate(
R.layout.custom_toast,
findViewById<View>(R.id.csToastContainer) as ViewGroup?
)

binding.btnShowToast.setOnClickListener {
val toast = Toast(this@MainActivity)
toast.duration = Toast.LENGTH_LONG
toast.setGravity(Gravity.BOTTOM, 0, 200)
toast.view = customToastView
toast.show()
}
}
}

Ответить
Abu bakar
Abu bakar - 15.12.2022 07:25

Perfect :)

Ответить
Hacking Kingdom
Hacking Kingdom - 06.11.2022 19:38

Your videos really helpfull to understand the concepts .Thanku ❤

Ответить
Javlon Tursunov
Javlon Tursunov - 05.11.2022 18:15

Bro please make videos related to making an app which can connect to Nodemcu WiFi module

Ответить
Mohamed Reda
Mohamed Reda - 22.08.2022 00:43

When I use the word "view" I see it written but crossed out. Does it have a newer version?

Ответить
Whateverslav
Whateverslav - 17.06.2022 15:18

Ahah! You are German! Eingabe betrayed you.

Ответить
Marcel Berkien
Marcel Berkien - 24.03.2022 10:39

What an excellent tutorial, with excellent hints on HOW to use these methods and techniques without sounding hurried. Thank you for putting in your efforts. You gained a fan!

Ответить
Deli
Deli - 20.02.2022 06:57

I like your videos. You are good at explaining things and you are easy to understand. Thanks

Ответить
amira yasmine
amira yasmine - 14.01.2022 13:29

you are amazing, thank you

Ответить
Nanonkay
Nanonkay - 01.01.2022 17:25

Did you just say Welcome Mr. Poop??? Lmao I wanna work with that guy now lol!!!!

Ответить
retoDenis
retoDenis - 16.12.2021 16:33

since api 30 setView is deprecated. Is any other easy way to set custom view for toast?

Ответить
Chad Zulu
Chad Zulu - 16.11.2021 20:16

Good ol' Mr. Poop! Another great video, thanks!

Ответить
Alex Gireff
Alex Gireff - 04.11.2021 00:27

Cool and clear as usual. Thanks🙏

Ответить
George Molnar
George Molnar - 28.10.2021 13:58

@Philipp - > " 'setter for view: View?' is deprecated. Deprecated in Java. "
Any chance in still doing custom toasts with the latest Kotlin implementation?!

Later EDIT:
It seems to be working fine, just throws a warning.

Ответить
Cristian Monterrosa
Cristian Monterrosa - 14.10.2021 01:20

Buen video

Ответить
Sergio Master
Sergio Master - 18.09.2021 22:28

view is deprecated how can I change that?

Ответить
GrumpyOldMan
GrumpyOldMan - 31.08.2021 10:17

This German accent is much easier on the ear than that of "Coding In Flow"

Ответить
Haziq Haris
Haziq Haris - 27.08.2021 17:31

Thank you so much

Ответить
Aarat Prasad Chopra
Aarat Prasad Chopra - 08.08.2021 09:13

The custom toast is deprecated now I think

Ответить
SuegroLM
SuegroLM - 07.08.2021 21:55

Superb

Ответить
Amandeep
Amandeep - 16.07.2021 08:04

I watch your videos even if I knew how to do that thing because you really teach all the small concepts which helps me to understand them better💯

Ответить
Muhammed Rabea
Muhammed Rabea - 07.07.2021 15:03

It was very helpful , Good work man.

Ответить
RIYAZAT KURESHI
RIYAZAT KURESHI - 08.06.2021 13:57

How to set width of toast match parent?

Ответить
Matt Graves
Matt Graves - 10.05.2021 13:17

Best explanation of Context in Android ever!

Ответить
lovesh purswani
lovesh purswani - 05.05.2021 22:23

Hey Phillip, I did the same thind as you did but the clToast ID that you gave in the layoutInflater Statement is hilighted as red and showing error: Unresolved reference.
Please can you help me with that

Ответить
Jack Tolmie
Jack Tolmie - 04.04.2021 23:52

Skip the part when he is making the custom Toast. It is depreciated, and will not work.

Ответить
Akshay Tatikondalwar
Akshay Tatikondalwar - 14.03.2021 13:07

Thanks man these tutorials are much better than the course i bought

Ответить
American Citizen
American Citizen - 21.02.2021 06:35

"Welcome, Mr. Poop!"

Ответить
Azmyin Md. Kamal
Azmyin Md. Kamal - 12.01.2021 21:59

What would be the commands for the custom Toast in Java?

Ответить
Alfian
Alfian - 11.12.2020 14:08

Please add subtitle english

Ответить
Karthick S
Karthick S - 07.11.2020 16:25

How to toast an error in onError(). I can't get any context.

Ответить
Валерий Николаев
Валерий Николаев - 01.11.2020 10:42

Thank you for this amazing videos!

Ответить
Ajay Galagali
Ajay Galagali - 16.09.2020 18:26

:)

Ответить
גיא־רפאל כהן
גיא־רפאל כהן - 18.06.2020 11:59

Hi, I have a problem with the custom toast.
The view variable has a strike line, and the error is : Unresolved reference: inflate

Ответить
גיא־רפאל כהן
גיא־רפאל כהן - 18.06.2020 10:35

How can I send you a private message please ?

Ответить
גיא־רפאל כהן
גיא־רפאל כהן - 18.06.2020 10:33

I liked the screen trainsition of "imagine ..." :)
Thanks a lot for your efforts!!!

Ответить
Сергей Ореховский
Сергей Ореховский - 11.06.2020 21:12

BOMB!!!

Ответить
wavecycle
wavecycle - 10.05.2020 10:20

This is very well done, thank you. I'm disabled and can only spend a limited time staring at a screen, and your explanations are clear enough that I can mostly follow just using audio!

Ответить
George Nady
George Nady - 14.04.2020 06:25

I am George From Egypt
really I wana tell you something .. you are learn the content in very detailed and this is the point for the beginners
you are awesome
good job and you will be something great soon <3

Ответить