1

I am new to android and I have been learning android from Bucky`s tutorials from youtube. I am using android studio 2.3.3. I am learning fragments and I have to use an overridden method by the name of "onAttach()",

Whenever i go for this method, its always crossed. Why is it so? Anyone?

Screenshot1

Screenshot2

hannan
  • 11
  • 2

2 Answers2

0

Bucky's tutorials are extremely out of date.I can still remember watching them in 2012. The crossed mark you saw means the method you're trying to override is deprecated. This doesn't mean it wouldn't work, however it means that anytime Google may remove it and then it wouldn't work. Either way, it is your job to stay up to date. Override methods that are not crossed. And try reading more tutorials than watching videos; they tend to be more informative.

Seaskyways
  • 3,630
  • 3
  • 26
  • 43
  • Thanks. And what do you recommend abt learnin android. I mean where do I learn from? What are the best internet sources to learn android? – hannan Jul 14 '17 at 10:27
0

You're overriding a deprecated onAttach(Activity activity) instead of onAttach(Context context). There's a lot to read about this problem here on SO, e.g. Android Fragment onAttach() deprecated.

lidkxx
  • 2,731
  • 2
  • 25
  • 44
  • Thanks. And what do you recommend abt learnin android. I mean where do I learn from? What are the best internet sources to learn android? – hannan Jul 14 '17 at 10:32