Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Even if you could find some hack to do this, this is not something you want to do. A better solution would be to listen for the ACTION_TIMEZONE_CHANGED, ACTION_TIME_CHANGED, and ACTION_DATE_CHANGED events and then change your previous time accordingly. This is actually very easy to do, I can provide sample code if you need help.</p> <p>TimeChanged.java</p> <pre><code>package com.example.stackoverflow17462606; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class TimeChanged extends BroadcastReceiver { public TimeChanged() { } @Override public void onReceive(Context context, Intent intent) { // Do whatever changes you need here // you can check the updated time using Calendar c = Calendar.getInstance(); } } </code></pre> <p>AndroidManifest.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.stackoverflow17462606" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;receiver android:name="com.example.stackoverflow17462606.TimeChanged" android:enabled="true" android:exported="true" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.TIMEZONE_CHANGED"/&gt; &lt;action android:name="android.intent.action.TIME_SET"/&gt; &lt;action android:name="android.intent.action.DATE_CHANGED"/&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Please remember that this will only fire if you've launched your app once on the device (to prevent apps from running themselves once their installed)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload