Android Question There's got to be a way to get the resolution of a widget

NeoTechni

Well-Known Member
Licensed User
Longtime User
Without using a set value in the layout. On my Nexus 5 lockscreen, the widgets resize, and can detect what resolution they're at. I'd love to do that, but right now I have to have the user enter the resolution in themselves to support resizing properly.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is a new broadcast intent in Android 4.1 that should allow you to get the size range named android.appwidget.action.APPWIDGET_UPDATE_OPTIONS

Try to add an intent filter with AddReceiverText and then handle this intent in Service_Start.

It seems to me that it will only be raised when the user resizes the widget.
 
Upvote 0

NeoTechni

Well-Known Member
Licensed User
Longtime User
public static final String OPTION_APPWIDGET_MAX_HEIGHT
Added in API level 16
A bundle extra that contains the upper bound on the current width, in dips, of a widget instance.

Constant Value: "appWidgetMaxHeight"
public static final String OPTION_APPWIDGET_MAX_WIDTH
Added in API level 16
A bundle extra that contains the upper bound on the current width, in dips, of a widget instance.

If we could get those somehow, that'd be a lot of help.
 
Upvote 0

NeoTechni

Well-Known Member
Licensed User
Longtime User
I recommend rewriting the widget guide to include that one guy's instructions for handling multiple widget types in a single program (or including it in the next version of Android) as well as this, cause these are really handy.
 
Upvote 0
Top