English 中文(简体)
A. 变换每3至5秒在安乐施会申请活动中
原标题:Ads Changing for every 3-5 seconds in an activity of Android Application

我正在开发一种海底应用,其中我利用网络服务在一项活动中执行了10项任务。 现在,我想规定每3至5秒改变这些要求的时间表。 请协助抽样代码/链接。 提前感谢。

最佳回答

刚与Countdown timer合作。

计划在将来一段时间内缩减,并定期通知。 在案文领域显示30次第二次缩减的实例:

new CountdownTimer(30000, 1000) {

     public void onTick(long millisUntilFinished) {
         mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
     }

     public void onFinish() {
         mTextField.setText("done!");
     }
  }.start();

http://developer.android.com/vis/android/os/CountDowntimer.html>rel=“nofollow”>

Further more.

问题回答

请提供更多资料。

你们应利用AlarmManager或时事服务,在每3-5秒中执行。

I have also make a function of using alarm manager auto logout if user ideal for 5 min then it is logout. public static void autoLogOut(Context context) {

    MyAlarmService.mContext = context;
    Intent myIntent = new Intent(context, MyAlarmService.class);
    pendingIntent = PendingIntent.getService(context, 0, myIntent, 0);

    AlarmManager alarmManager = (AlarmManager) context
            .getSystemService("alarm");

    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.add(Calendar.SECOND, (5 * 60));
    alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
            pendingIntent);

    // Toast.makeText(context, "Start Alarm", Toast.LENGTH_LONG).show();
}

如果用户对5分钟有理想,则在使用后执行。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签