Change remoteView ImageView background

BrainCrash picture BrainCrash · Jun 13, 2011 · Viewed 17.5k times · Source

I have some remoteView with ImageViews, and I need to change the "android:background" programmatically.

I know how to change the "android:src" with:

remoteView.setImageViewResource(int viewId, int srcId);

And it works fine, but how do I change the "android:background"?

Thanks

Answer

jamapag picture jamapag · Jun 16, 2011

You can use public void setInt (int viewId, String methodName, int value) method.

remoteView.setInt(R.id.viewid, "setBackgroundResource", R.color.your_color)