Android – Retrieve Device’s SDK version and API level

By -

Ques:How do i fetch device’s SDK version and API level number?
Ans:
Build.VERSION.SDK_INT => To know API Level number i.e. 7,8,9
Build.VERSION.RELEASE => To know version code i.e. 2.1, 2.2, 2.3, 3.0

For your info,
// SDK_INT is only available in 1.6 and in newer
// REALEASE works on every version released so far.

For exaple:

   TextView txtView = (TextView) findViewById(R.id.textView1);
   txtView.setText("SDK API Level =>" +Build.VERSION.SDK_INT);
   txtView.append("n Build.VERSION.RELEASE =>"+Build.VERSION.RELEASE);
Paresh Mayani

Lazy android developer, exploring the horizon of android development since 7 years, currently working as a Technical Lead - Android at Simform Solutions, India. Former Application Architect at KarConnect. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

Loading Facebook Comments ...
Loading Disqus Comments ...