YektaDev
YektaDev

Reputation: 540

How to get TimeZone in low API levels?

The goal is to get the device TimeZone using TimeZone.getDefault(); however, this dependency needs an API level of 24 or above, which is higher than the project minimum SDK version.

Are there any other solutions to retrieve the device TimeZone in lower API levels?

Upvotes: 2

Views: 414

Answers (1)

YektaDev
YektaDev

Reputation: 540

It was just a small mistake. I was importing android.icu.util.TimeZone instead of java.util.TimeZone.

The correct import for TimeZone in this case is:

import java.util.TimeZone;

Upvotes: 4

Related Questions