I want to use switch(view) or toggle(view) in removteviews, but it will get a RemoteServiceException when I put in layout.xml.
In android development webpage(appwidgets), the switch/toggle are not in the supported lists.
So, how can I use the switch/toggle in remoteview layout?
You don’t. You can try to use a
ButtonorImageButton, where you adjust the contents of the face of the button to represent a “toggled” state, as those are supported by app widgets. No subclass ofCompoundButtonis supported, probably because there is no way to read the value of the button from the app widget.