简体   繁体   中英

Error: method onEnable does not override or implement a method from a supertype

I can't build my app because I've got this error:

Error:(117, 5) error: method does not override or implement a method from a supertype.

I'm trying to do a class that extends from AppWidgetProvider and I can't override onEnable method

@Override
public void onEnable(Context context) {

    Log.e(LOGTAG, "Se ha activado onEnable");
    super.onEnabled(context);
    AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.add(Calendar.SECOND, 1);
    alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 10000 , createClockTickIntent(context));

}

To override method of super class you should use the same name of the method and parameters

 @Override
 public void onEnabled(Context context) {
  //your code
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM