http://stackoverflow.com/questions/1299837/cannot-refer-to-a-non-final-variable-inside-an-inner-class-defined-in-a-differen

use a final local variable instead as below:

public static final boolean postDelayed(Context context, Alarm alarm, long delayMillis) {

        final Context sContext = context;

        final Alarm sAlarm = alarm;

        return sHandler.postDelayed(new Runnable() {

            @Override public void run() {

                Intent playAlarm = new Intent(Alarms.ALARM_ALERT_ACTION);

                playAlarm.putExtra(Alarms.ALARM_INTENT_EXTRA, sAlarm);

                sContext.startService(playAlarm);

              }

        }, delayMillis);

    }

版权声明:本文博主原创文章,博客,未经同意不得转载。

05-11 22:17
查看更多