本文整理汇总了Java中android.content.Intent.ACTION_TIME_TICK属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.ACTION_TIME_TICK属性的具体用法?Java Intent.ACTION_TIME_TICK怎么用?Java Intent.ACTION_TIME_TICK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.ACTION_TIME_TICK属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
@Override
public void onReceive(Context context, Intent intent) {
byte adjustReason;
switch (intent.getAction()) {
case Intent.ACTION_TIME_CHANGED:
adjustReason = TimeProfile.ADJUST_MANUAL;
break;
case Intent.ACTION_TIMEZONE_CHANGED:
adjustReason = TimeProfile.ADJUST_TIMEZONE;
break;
default:
case Intent.ACTION_TIME_TICK:
adjustReason = TimeProfile.ADJUST_NONE;
break;
}
long now = System.currentTimeMillis();
notifyRegisteredDevices(now, adjustReason);
updateLocalUi(now);
}
示例2: onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
h1View = (ImageView)findViewById(R.id.h1);
h2View = (ImageView)findViewById(R.id.h2);
m1View = (ImageView)findViewById(R.id.m1);
m2View = (ImageView)findViewById(R.id.m2);
setTime();
receiver = new TickReceiver();
filter = new IntentFilter(Intent.ACTION_TIME_TICK);
}
示例3: setReceiver
private void setReceiver() {
IntentFilter timeFilter = new IntentFilter(Intent.ACTION_TIME_TICK);
timeReceiver = new TimeReceiver();
timeReceiver.setActivity(this);
timeReceiver.setRecommendFragment((GankRecommendFragment) mFragmentList.get(0));
internetReceiver = new InternetReceiver();
registerReceiver(timeReceiver, timeFilter);
internetReceiver = new InternetReceiver();
internetReceiver.setActivity(this);
IntentFilter InternetFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(internetReceiver, InternetFilter);
}