Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TimePicker getCurrentMinute, getCurrentHour method is deprecated in API 23

Tags:

I'm Creating a Alarm based Application with API version 23. But TimePicker getCurrentMinute,getCurrentHour method is Deprecated. Which method will be replace of this method ?

EDIT:

According to google documentation now we have to use getMinute() and getHour() method. But it's only working in api 23. what we have to do for other api?

like image 299
Yeahia2508 Avatar asked Oct 29 '15 13:10

Yeahia2508


1 Answers

Just check the Android official docs .. http://developer.android.com/reference/android/widget/TimePicker.html

it tells you everything

public Integer getCurrentMinute ()  Added in API level 1 This method was deprecated in API level 23. Use getMinute()  Returns the current minute 

and

public Integer getCurrentHour ()  Added in API level 1 This method was deprecated in API level 23. Use getHour()  Returns the current hour in the range (0-23) 

Android offers runtime checks for API version. Most of the time in such cases, you'll want to run cases like

if (Build.VERSION.SDK_INT >= 23 )      myTimePickerView.getHour(); else      myTimePickerView.getCurrentHour(); 

@see http://developer.android.com/reference/android/os/Build.VERSION.html

like image 199
FrancescoC Avatar answered Sep 22 '22 12:09

FrancescoC