I found strange behavior on some devices when adding a new instance of appwidget to the main screen.
I have an AppWidget application with configuration. As the appwidget tutorial update said, I have to do it myself.
public static void updateWidgetAndSendIntent (Activity activity, int mAppWidgetId, boolean isUpdate) { updateWidgets(activity); if (!isUpdate) { Intent resultIntent = new Intent(); resultIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); activity.setResult(Activity.RESULT_OK, resultIntent); activity.finish(); } } public static void updateWidgets(Context context) { new ManagerUpdateWidget(context).updateAllWidgetInstances(); }
ManagerUpdateWidget.java
public void updateAllWidgetInstances() { Bitmap widget = getCustomView(context); for (int widgetId : appWidgetIds) { updateCurrentInstance(widgetId, widget); } }
The fact is that on the Samsung Galaxy Note 2 (GT-N7100) with Android 4.4.2 everything is fine, but on the Samsung Galaxy Note 3 (SM-N900) with Android 5.0 I have a "phantom" appwidget, and not a real appawidget on the main screen, but βphantomβ, when you do not see the appwidget on the screen, but inside your application the Appwidget exists with an identifier and regular updates. I tested my application on genymotion emulators (Android 4.3 and 5.0), but everything was fine.
Please tell me how to fix this strange error.
android android-appwidget
Alex Zezekalo
source share