Type is out of date

I use AbsoluteLayout for Activity and define it in an XML file.

I added this line of code because I'm trying to add a list of buttons dynamically and I get the following warning.

private AbsoluteLayout layout = (AbsoluteLayout) findViewById(R.id.viewsaved); The type AbsoluteLayout is deprecated 

The code still works correctly, but I was just curious to know if anyone knows why this warning appears?

Thanks for any help!

+4
source share
5 answers

In computer software or authorship of software standards and documentation, the term "obsolescence" applies to software functions that are replaced and should be avoided. Although deprecated features remain in the current version, their use may enhance warning messages that recommend alternative practices, and deprecation may indicate that this feature will be removed in the future. Features: outdated, not deleted - to ensure backward compatibility and provide programmers who used the time for their code in accordance with the new standard.

From Wikipedia - obsolescence

In short, the function will still work, but will most likely be removed in future versions. You need to find something to replace it.

AbsoluteLayout suggests using FrameLayout , RelativeLayout or your own layout instead.

+10
source

Appears because it is out of date. In any case, you should not use AbsoluteLayout , it was deprecated for a good reason.

The reason is that it does not automatically handle multiple screen sizes, which is a very important aspect of Android.

+1
source

Outdated code is code that is still in release for backward compatibility reasons (i.e. for older programs), but has surpassed the newer and better piece of code.

For a list of buttons, I would recommend either ListView or LinearLayout , as they will allow you to add items to the list format. If you need to use AbsoluteLayout to position it, then you will need to be more inventive when using LinearLayout and RelativeLayout s

0
source

Means that it is marked for deletion and will go to a future version of Android. From http://developer.android.com/reference/android/widget/AbsoluteLayout.html

This class is deprecated. using FrameLayout, RelativeLayout or instead.

0
source

In most Java libraries, especially the very popular ones, developers try very hard to make sure that you are writing code against an old version of the library that will not break into a newer version (backward compatibility.)

However, sometimes they realize that they have made mistakes that are fundamental to the library as a whole and cannot be fixed. In this case, they condemn. This means that "yes, it will work the same as before, but be careful: there is a serious error in this." They usually follow this with a suggested replacement.

In a related note, while I had not done Android yet, I did a lot of Java gui development. It is so tempting to say: "I just use absolute positioning. I have no problem tracking everything." But as your program grows, it’s fairly confident that all this keeps everything under control. Only now do you have tons of code that needs to be reorganized in order to change it to a more convenient layout. Do not fall into this trap: use a good layout manager from the very beginning!

-1
source

All Articles