问题
For some reason, the onDisabled and onDeleted method of my widget is not getting called when i remove the widget from the homescreen. I don't know why.
Here's the code:
public class WidgetProvider2x1 extends AppWidgetProvider {
@Override
public void onEnabled(Context context) {
Log.i("MyTag", "onEnabled");
super.onEnabled(context);
}
@Override
public void onDeleted(Context context, int[] appWidgetIds) {
Log.i("MyTag", "onDeleted");
Toast.makeText(context, "onDeleted", Toast.LENGTH_SHORT).show();
super.onDeleted(context, appWidgetIds);
}
@Override
public void onDisabled(Context context) {
Log.i("MyTag", "onDisabled");
Toast.makeText(context, "onDisabled", Toast.LENGTH_SHORT).show();
super.onDisabled(context);
}
LogCat also does not show anything.
来源:https://stackoverflow.com/questions/13988944/ondisabled-and-ondeleted-method-not-being-called