Android: Changing LinearLayout in a widget.
- by Profete162
Hello all,
I have this really annoying problem:
In my widget, i would like to change the background by code. I noticed on the Google doc than I can easily change the background of an Imageview:
remoteViews.setImageViewResource(R.id.my_iv, R.drawable.my_bg);
Ok, too easy, i want to change now the Linear layout.. What I read about the remoteview id that I can change a Bitmap, Int, Bool, String, etc... but not a drawable. So i guess i cannot use:
remoteViews.setBitmap(R.id.my_ll,"setBackgroundDrawable",BitmapFactory.decodeResource(context.getResources(), R.drawablemy_bg));
I am totally disapointed and tried a last idea:
views.setInt(R.id.my_ll,"setBackgroundResource",R.drawable.my_bg);
But The logcat told me:
android.widget.RemoteViews$ActionException:view:
android.widget.LinearLayout can't use
method with RemoteViews:
setBackgroundResource(int)
I am totally lost and I really don't know what to do...
I would really appreciate any help.
Thank a lot!