Click here to Skip to main content
15,119,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i am using android studio and making an app for my phone which has android 4.2 (api level 17) operating system. Android studio tells error if i use something which requires higher levels. But i noticed today that i can use for example "startActivity" that documantation says "Android API 27 platform". Is this different from Api level?

What I have tried:

I did not try anything but i want to learn.
Kornfeld Eliyahu Peter 17-Jul-18 7:57am
It seems that it shows the latest API level for methods you use when it exist in your selected level too...
startActivity is there since API level 1...
leone 17-Jul-18 10:43am
so you say startActivity was re-implemented in Api 27?
Kornfeld Eliyahu Peter 17-Jul-18 12:00pm
No. It was there way before 27, but 27 is the latest version and your code compiled against it...
David Crow 17-Jul-18 10:59am
startActivity(Intent) has existed since API 1, whereas startActivity(Intent, Bundle) has existed since API 16.

You should always be compiling with the latest API.
Mike V Baker 17-Jul-18 12:31pm
I would like to concur w/David and add that you do not need to compile to 17 in order to support back to 17. You should always have your compile target set to support up to the most current version and put the earliest version you want to support into your "Min SDK Version" of the project structure dialog's flavors tab.
leone 18-Jul-18 6:48am
Thank you everybody i just got it. I thought i am just coding for 17. It is from min Api to Target api, and 27 is my target api. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900