Search code examples
javaandroidvisual-studioapiprogressdialog

Can I use deprecated classes?


  1. Will using deprecated classes cause severe problems to the program?

  2. What is the meaning of deprecated?

  3. Can I still work with deprecated classes?

An example for it is the ProgressDialog view in Android. It deprecated from API 26 and the replacement is the ProgressBar view. What happens if I will still use the ProgressDialog? It is extremely comfortable and exactly what I was aiming for.


Solution

  • From the documentation:

    A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. Compilers warn when a deprecated program element is used or overridden in non-deprecated code.

    So you can use some deprecated methods but it won't be the best practice because there are better alternative exists(but in some cases this can even be dangerous)