-1

hello guys can anyone help to solve this error, I am not a developer

public class SimpleWidgetProvider extends AppWidgetProvider {

    @Override
    public void onUpdate() {

    }
}

I tried this but I am not sure if this is right:

@Override
    public void onUpdate(Context paramContext, AppWidgetManager paramAppWidgetManager, int[] paramArrayOfInt)

    {
    }

}
Mubashir Ali
  • 559
  • 2
  • 8
  • 23
  • you need to override onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) and NOT public void onUpdate() if you are extending AppWidgetProvider ......remove @override from void onUpdate() – Laxmikant Jun 29 '18 at 03:33
  • 1
    What is the signature of the method you want to override in `AppWidgetProvider`? Use the same for your method. – Henry Jun 29 '18 at 03:34
  • 1
    Argument types are part of method signature. If they differ then you are not overriding, you are overloading. – Pshemo Jun 29 '18 at 03:35
  • 1
    What you tried should have worked, because the signature you tried matches the signature in the AppWidgetProvider class. Were there any other errors, like symbol not found? You may need to import either AppWidgetManager and/or Context into your class. – Dawood ibn Kareem Jun 29 '18 at 03:50

2 Answers2

-1

When you use extends SomeClass is for extending a class.

In other words, you are required to override @Override existing functions in this class, this is an inherent condition of extends.

I recommend you see this link: not onUpdate in AppWidgetProvider

In my opinion your question needs to be a bit more detailed, I do not even know which error is displayed to you.

Let us know about your progress Regards,

Good luck.

Java Documentation: https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html

  • I tried this now but I have a error (Variable 'j' might not have been initialized) link java code : https://pastebin.com/R3mr9JYC – Ilias Rami Jun 29 '18 at 06:08
  • You are using the J variable within your Try Catch, but you are assigning a value to it only within the "IF" condition. Now imagine that your code never goes through "IF", what should be the value of J if that happens? Currently in your code the value of J outside "IF" is NULL, this is causing the error. To solve this, assign a value to J on line 24, such as `int j = 0;` – Leonardo Feriato Jun 29 '18 at 19:22
-1

Your parent and child classes should have with parameters