Why are the API demos considered as "legacy", as of API 18?
Asked Answered
N

1

7

After installing the newest ADT & SDK of Android to support API 18, I've noticed that all of the API demos are now considered "legacy".

Here's a screenshot:

Enter image description here

How come?

I've noticed that even though they are considered "legacy", they contain some things that do belong to API 18, for example this attribute that was found on the manifest:

android:theme="@android:style/Theme.Holo.NoActionBar.Overscan"

It's also weird that this is the only thing Lint warns me about when having minSdk to be lower than API 18 - this can't be the only new thing on API 18 that the demos contain, can it?

What is going on with it, and will we have a different set of samples?

Nervous answered 22/9, 2013 at 12:26 Comment(14)
Where do you see this "legacy" notation?Lixivium
@Lixivium i've now updated the question with a screenshot. it is shown when you create a new sample android project.Nervous
IMHO, you will have a better chance of getting an answer for this on the adt-dev Google Group.Lixivium
@Lixivium how do i do that? maybe the answer will be revealed on the next time we have a google event , when google will show their new nexus device.Nervous
"how do i do that?" -- um, join the Google Group and ask a question.Lixivium
@androiddeveloper: AFAIK, there's no legacy notation ever for any release of Android API, including Level 19. Did you install ADT & SDK over an existing directory or into a new directory? Perhaps some files were left over from a previous installation.Zaffer
@Zaffer i didn't install, as both the SDK and ADT already have a feature of updating themselves. i think i've even tried (in order to fix something else) to uninstall them both and re-install them, and i still see the "legacy" items.Nervous
@androiddeveloper: I was curious so I set up another Android project and voila, I do see the legacy notation, so I stand corrected. This is to do with the version of the API you selected when you create / load an Android project. So, if you select a target of 17 (Android 4.2.2) or earlier, you'll will not see the legacy notation. Anything from API 18 onwards, you will see it. What it is is that some of the sample Android projects were written some time ago, and Google may not have updated them in line with the latest API levels. I would just ignore the legacy notation and continue.Zaffer
@Zaffer no, this is the weird part. they still update them. the new API demos of API 19 already have things that belong only to API 19 . you can run Lint to see it for yourself - it will complain about some classes and functions that are only for API 19 . an example is the class "SystemUIModes.java" , which has a reference to "View.SYSTEM_UI_FLAG_IMMERSIVE" , which belongs to API 19.Nervous
@androiddeveloper: Yes. But if you look closely, legacy here can mean one or two things: 1) There are methods contained in a sample Android project which are now deprecated in API 19 (the APIDemos project has a few of them e.g. Notification(int, CharSequence, long)), or 2) The notation acts as a visual cue to alert [new] Android developers that a given project may contain "legacy" codes i.e. support earlier versions of Android. This notation won't cause you any grief, so I would ignore it and continue development.Zaffer
In Android Studio if you try to import the samples project now, you will see 'legacy' folder under android-19. This folder is in the same directory level as 'background', 'connectivity', 'content', 'input', 'media', 'security', 'testing', 'ui'. So @androiddeveloper's original question is valid!Favin
@Favin i don't understand what's wrong with what i've written. i can still see it as "legacy" even now...Nervous
Who said there is something wrong?Favin
@Favin i just didn't understand what you've written, so i assumed you are saying that there is something wrong with what i've written... :)Nervous
I
1

The non-legacy projects all have a build.gradle file, that you can simply open in Android Studio*. The legacy projects don't have a build.gradle file and if you want to open them in Android Studio you need to either go through "create new project over existing sources" or android update project before you're good to go.

*) not entirely true: some of them point to outdated versions of the Android plugin and you need to tweak the project settings first.

Idaliaidalina answered 13/11, 2013 at 0:5 Comment(5)
that's the cause for legacy?! even though they keep updating them?!Nervous
I believe so, but I haven't heard anything official about it. It's the only obvious difference that I can see.Idaliaidalina
does it mean that some day google will ditch eclipse and support only their new IDE (android studio) ? i don't like the new IDE ... it lacks many things i'm used to on eclipse... :(Nervous
I don't know their plans.Idaliaidalina
In Android Studio, how can I import the API demos?Nervous

© 2022 - 2024 — McMap. All rights reserved.