Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type is deprecated

Tags:

java

android

I am using an AbsoluteLayout for a Activity and have it defined in a xml file.

I added this line of code because I am 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 appears to work properly, but I was just curious to see if anyone knows why this warning appears?

Thanks for any help!

like image 610
korymiller Avatar asked Dec 17 '22 14:12

korymiller


1 Answers

In computer software or authoring programs standards and documentation, the term deprecation is applied to software features that are superseded and should be avoided. Although deprecated features remain in the current version, their use may raise warning messages recommending alternative practices, and deprecation may indicate that the feature will be removed in the future. Features are deprecated—rather than being removed—in order to provide backward compatibility and give programmers who have used the feature time to bring their code into compliance with the new standard.

From Wikipedia - Deprecation

In short, the function will work for now but will likely be removed in future versions. You'll want to find something to replace it with.

AbsoluteLayout suggests you use FrameLayout, RelativeLayout or a custom layout instead.

like image 122
Haphazard Avatar answered Dec 28 '22 02:12

Haphazard