Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change remoteView ImageView background

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

like image 463
BrainCrash Avatar asked Jun 13 '11 17:06

BrainCrash


1 Answers

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

remoteView.setInt(R.id.viewid, "setBackgroundResource", R.color.your_color)
like image 146
jamapag Avatar answered Nov 14 '22 09:11

jamapag