Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8438141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:37:35+00:00 2026-06-10T07:37:35+00:00

In my Application I am displaying some info to the users according to the

  • 0

In my Application I am displaying some info to the users according to the user’s TimeZone.
I am allowing the users to select different cities in the world and to get the required info. By default I will get the TimeZone of the user from their Device using

                `TimeZone myTZ = TimeZone.getDefault();`

And once the user changes the TimeZone , I am saving it in preferences. No problem in storing and retrieving the values from the preferences.

When another TimeZone is selected I set that TimeZone as default TimeZone using

       `TimeZone.setDefault(TimeZone.getTimeZone("my_timezone"));`

when I print the TimeZone in the Log I am getting the TimeZone value as I set it. But when I use that TimeZone in my calculations I am getting previous TimeZone Value.

So I think the problem is the TimeZone is not changing , I want the user to set the selected TimeZone as their default TimeZone in their device. How shall I do this. What is the mistake I am doing?

Getting stuck in this for three days. Any suggestions to get out from this? Quick suggestion will helps me a lot. Thanks in Advance!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:37:36+00:00Added an answer on June 10, 2026 at 7:37 am

    As per documentation for TimeZone.setDefault(...) –

    Overrides the default time zone for the current process only.

    Warning: avoid using this method to use a custom time zone in your
    process. This value may be cleared or overwritten at any time, which
    can cause unexpected behavior. Instead, manually supply a custom time
    zone as needed.

    Apparently to change timezone through code you have to use AlarmManager. See the discussion here.

    AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
    alarm.setTimeZone(timezone);
    

    It requires this permission to be set in the manifest

    <uses-permission  android:name="android.permission.SET_TIME_ZONE"></uses-permission>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Java application is displaying some odd behaviour, and I'm having trouble finding a
Ola Folks, In an iPhone application I am displaying different views by using the
I am working on an iPad application, displaying TableView listing according to returned data
I am displaying some HTML text in an Adobe AIR Application that I do
I am designing an Android application which will be displaying some news that will
I have written a small Python application where I use PyGame for displaying some
I'm developing my first Android application and it is based partly on displaying some
I've a (C#).NET GUI application. Where I need console for displaying some output. The
here ia an application where i displaying some text with image background but it
i am displaying some locations using Google map in my application, and displaying all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.