Tamás Bolvári Tamás Bolvári - 11 months ago 88
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);


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);