Override onEnabled
instead of using a static block.
How can get context in my Own method or static block?
-
29-05-2022 - |
Question
I am in AppWidgetProvider
class. I want to call a static block before any callback method, but I need the context inside my static block. How can I get that?
Below is my code:
public class widgetClass extends AppWidgetProvider {
static
{
// here i want the context
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds){
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow