Tamás Bolvári Tamás Bolvári - 1 year ago 141
Android Question

How to disable a button in a remote view?

I can make it invisible using the code below, but can't disable it.

RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.notification);
contentView.setViewVisibility(R.id.buttonToDisable, View.INVISIBLE);

Answer Source

setEnabled() is a @RemotableViewMethod, at least on the now-current master branch of the source code. Hence, you should be able to use setBoolean():

contentView.setBoolean(R.id.buttonToDisable, "setEnabled", false);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download