Re: [android-developers] Re: how to change background of a widget

2011-01-28 Thread Kostya Vasilyev

Cool!

28.01.2011 16:39, cellurl пишет:

That worked so easily, I didn't believe it at first!
Only the experts know "the workarounds". Thanks Kostya!
-cellurl

On Dec 18 2010, 3:45 am, Kostya Vasilyev  wrote:

17.12.2010 23:03, cellurl пишет:


More info. It says RemoteView doesnt have setImageResource().
Q: Does that mean I am out of luck??
-cellurl

RemoteViewshas setImageViewResource.

http://developer.android.com/reference/android/widget/RemoteViews.htm...,
int)

Put an ImageView into your RelativeLayout, size it to fit the entire
layout, and it's as good as having abackgroundimage.

Might want to also setbackground="@android:color/transparent" for the
relative layout, as an optimization.

--
Kostya Vasilyev -- WiFi Manager + prettywidget--http://kmansoft.wordpress.com



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: how to change background of a widget

2011-01-28 Thread cellurl
That worked so easily, I didn't believe it at first!
Only the experts know "the workarounds". Thanks Kostya!
-cellurl

On Dec 18 2010, 3:45 am, Kostya Vasilyev  wrote:
> 17.12.2010 23:03, cellurl пишет:
>
> > More info. It says RemoteView doesnt have setImageResource().
> > Q: Does that mean I am out of luck??
> > -cellurl
>
> RemoteViewshas setImageViewResource.
>
> http://developer.android.com/reference/android/widget/RemoteViews.htm...,
> int)
>
> Put an ImageView into your RelativeLayout, size it to fit the entire
> layout, and it's as good as having abackgroundimage.
>
> Might want to also setbackground="@android:color/transparent" for the
> relative layout, as an optimization.
>
> --
> Kostya Vasilyev -- WiFi Manager + prettywidget--http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: how to change background of a widget

2010-12-18 Thread Kostya Vasilyev

17.12.2010 23:03, cellurl пишет:

More info. It says RemoteView doesnt have setImageResource().
Q: Does that mean I am out of luck??
-cellurl



RemoteViewshas setImageViewResource.

http://developer.android.com/reference/android/widget/RemoteViews.html#setImageViewResource(int, 
int)


Put an ImageView into your RelativeLayout, size it to fit the entire 
layout, and it's as good as having a background image.


Might want to also set background="@android:color/transparent" for the 
relative layout, as an optimization.


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: how to change background of a widget

2010-12-17 Thread Mark Murphy
On Fri, Dec 17, 2010 at 3:03 PM, cellurl  wrote:
> More info. It says RemoteView doesnt have setImageResource().
> Q: Does that mean I am out of luck??

One option is to use a layout file that has your desired background.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: how to change background of a widget

2010-12-17 Thread cellurl
More info. It says RemoteView doesnt have setImageResource().
Q: Does that mean I am out of luck??
-cellurl

---code-

   This Line unHappy->
views.setImageViewResource(R.id.widget,
R.drawable.widget_bg_normal_speedlimit);

int appWidgetId= Global.myAppWidgetId;
if(appWidgetId != 0) {
 
org.wikispeedia.SpeedLimitc.WordWidget.myAppWidgetManager.updateAppWidget(appWidgetId,
views);
} else {
Log.d("TAGG","You forgot to re-add the widget OR we are using
an old-installed one...");
}

---error--
WARN/ResourceType(615):
Skipping entry 0x7f090002 in package table 0 because it is not
complex!
WARN/AppWidgetHostView(615):
updateAppWidget couldn't find any view, using error view
at android.widget.RemoteViews$ActionException: view:
android.widget.RelativeLayout doesn't have method:
setImageResource(int)
at android.widget.RemoteViews$ReflectionAction.apply(RemoteViews.java:
438)
at android.widget.RemoteViews.performApply(RemoteViews.java:855)
at android.widget.RemoteViews.apply(RemoteViews.java:832)
at
android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:
167)
at
android.appwidget.AppWidgetHost.updateAppWidgetView(AppWidgetHost.java:
243)
at android.appwidget.AppWidgetHost
$UpdateHandler.handleMessage(AppWidgetHost.java:73)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)
INFO/ActivityManager(572):
Stopping service: org.wikispeedia.SpeedLimitc/
apt.tutorial.WidgetService

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en