0

Android Studio Screenshot

Suddenly my Android Studio is giving me deprecated MainActivity.java files for any new projects. I resinstalled Android Studio, but still the problem is not solved.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Amit Chhatbar
  • 93
  • 1
  • 9

1 Answers1

2

Java files cannot be deprecated. References to Java classes, methods, and fields can be deprecated.

The only thing that I see that is deprecated in that screenshot is the call to setDrawerListener() on the DrawerLayout. Presumably, you decided to use the Navigation Drawer activity template when you created your project.

Your options are:

  1. Ignore the deprecation warning, as setDrawerListener() is not shown as deprecated in the JavaDocs. UPDATE The JavaDocs are out of date. You could change the call to addDrawerListener(), which is the recommended replacement, if you wanted.

  2. Do not use that template.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • My [edit suggestion](http://stackoverflow.com/review/suggested-edits/12207961) got rejected, I could see same edit to the question. – Raju May 01 '16 at 17:50
  • @Raju: The edit suggestion diff indicated that you only changed the caption. I did not realize that the diff would not show the inline image. My sincere apologies. – CommonsWare May 01 '16 at 17:53
  • @CommonWare, That's quite alright & I understand. Because markdown won't show any difference, but rendered view does. – Raju May 01 '16 at 17:59