语言

Menu
Sites
Language
Limit number of widget

안녕하세요.

widget board를 구현한 후 home screen에서 widget을 추가할 때, 이를 하나로 제한하고 싶습니다.

예를 들어, 심박수 측정 widget을 생성하면 다음 widget 생성 화면에 심박수 측정 widget은 나타나지 않습니다.

이와 같은 설정할 수 있는 방법이 궁금합니다.

감사합니다.

 

=====================================================================

Hi,

We can add lots of same widget to the widget screen of Gaear S2 using default native widget template.

I want to restrict only one widget.

Regards,

Seonwoon.

编辑者为: Kim 11 4月, 2016

响应

5 回复
Masum Talukder

Please post your query in English...

thanks.

daniel kim

Hi,

In case of S health widget( for example, hear bit measure) of Gear S2, we cat add only one widget to the widget screen.

But we can add lots of same widget to the widget screen of Gaear S2 using default native widget template.

This is his query and I've searched document for him. but so far, could not find any way how to achieve this.

Regards

daniel kim

He need to add only one widget to widget screen for his widget.

Regards

Alex Dem

Hi,
I did not face such possibility.
Alexey.

Alex Dem

Hi,
But I think this feature could be implemented programmatically. I did not check for Gear but for Native Mobile Widgets it so simple (and should be the same):
Just add some variable which should be count of widget's instances (globally or in some structure) and initialize it: 

int instance_count =0;

1) widget_instance_create is called every time after new instance of widget has been created: so you should increment this count:

if(instance_count >0) return WIDGET_ERROR_ALREADY_EXIST;
instance_count++;

2) use widget_instance_destroy to set it to 0  back (or decrement from 1 to 0).
Alexey.