final Handler autoGalleryHandler = new Handler() {
public void handleMessage(Message message) {
super.handleMessage(message);
switch (message.what) {
case 1:
galleryFlow.setSelection(message.getData().getInt("pos"));

break;
}
}
};

Timer autoGallery = new Timer();
autoGallery.schedule(new TimerTask() {
int gallerypisition = 0;
@Override
public void run() {
if (gallerypisition < adapter.getCount() - 1) {
gallerypisition = gallerypisition + 1;
} else {
gallerypisition = 0;
}

Message msg = new Message();
Bundle date = new Bundle();// 存放数据
date.putInt("pos", gallerypisition);
msg.setData(date);
msg.what = 1;//消息标识
autoGalleryHandler.sendMessage(msg);
}
}, 0, 3000);//5秒后,每隔5秒执行信息发送

更多相关文章

  1. Android内核的根文件系统
  2. 源码剖析: Notification的发送
  3. android 客户端 smtp 协议发送数据
  4. android 定时发送短信
  5. Android(安卓)使用广播(BroadcastReceiver)传递数据
  6. android发送QQ邮件(带附件)
  7. android群发短信时判断短信是否发送成功
  8. android 微信登录
  9. android下联网

随机推荐

  1. Android仿QQ登录界面示例,实现登录、注册
  2. Android(安卓)5.0状态栏通知图标的实现
  3. (二)Unity 与 Android的布局管理
  4. Android(安卓)Studio 第八十三期 - Andro
  5. Android读取应用列表权限漏洞
  6. Android动态加载第三方APK的View研究过程
  7. Android(安卓)Studio 翻译插件Translatio
  8. Android中插件开发篇之----类加载器
  9. android 端全新指纹识别框架,适配 androi
  10. Android获取并显示图片