0

In android 4.2, there is a new callback called onWidgetOptionChanged() in which a bundle containing the widget size information is passed back. http://developer.android.com/guide/topics/appwidgets/index.html#AppWidgetProvider

My question is, how do we get the widget size prior to android 4.2?

I need to set a picture to an ImageView in the widget but I need to know the size of the ImageView / Widget to scale the picture accordingly.

Also, the layout used for the widget changes depending on its size. Without onWidgetOptionChanged(), how does one know when to use a different layout depending on the size of the widget?

Tikiboy
  • 892
  • 10
  • 20
  • Check [if this helps](http://stackoverflow.com/a/2864490/1777090) – MysticMagicϡ Jun 30 '14 at 05:02
  • @PurpleDroid Ive looked at that link before. Unfortunately I cant get the reference to the ImageView to use an ImageView.postDelayed(int) method. Creating a custom ImageView is also out of the question due to the limitation of RemoveViews in Home Screen Widgets. – Tikiboy Jun 30 '14 at 05:25

1 Answers1

0

I'm afraid that you cannot get current widget size on android before 4.2. Only preconfigured widget size through android.appwidget.AppWidgetManager#getAppWidgetInfo.

Pete
  • 57,112
  • 28
  • 117
  • 166
Andrei Tanana
  • 7,932
  • 1
  • 27
  • 36