4

I am working to make Launcher Application. I have created some temporary widgets for some purpose in my home screens. Now I want to remove that widgets from screen without drag and drop. So I want to know that it is possible or not ? And if possible then give some hint. I am also happy if i can remove widget on click of itself widget.

I have tried this but not working for me appWidgetHost.deleteAppWidgetId(launcherAppWidgetInfo.appWidgetId);

Harsh Trivedi
  • 1,012
  • 8
  • 25

1 Answers1

2

Take a look at this question. It appears that this isn't possible: I guess to prevent changing a user's setup without explicit permission.

On the same page it shares why your current method does not work:

Unfortunately, that does not work because deleteAppWidgetId() does not remove the widget from the home screen but just stops listening to changes for this AppWidget

Community
  • 1
  • 1
doydoy
  • 4,021
  • 3
  • 20
  • 33
  • I just want to remove widget like NOVA Launcher. They can able to add widget and remove widget without drag and drop. – Harsh Trivedi Oct 21 '13 at 05:59
  • More evidence to the negative: _[App widgets (home screen widgets) live in separate process and you have no control on adding/removing them. All you can do is tell in your AndroidManifest.xml that you have a new appwidget and user will seen it when he decides to place something to his homescreen._](https://groups.google.com/forum/#!topic/android-developers/5kqWygpdk4g.) Not sure how NOVA managed it but so far all signs point to no. – doydoy Oct 21 '13 at 07:41