开发者

Android onEnabled() lifecycle after process was killed

开发者 https://www.devze.com 2023-02-28 22:51 出处:网络
According to the documentation the lifecycle of the AppWidgetProvider class is managed by the Android platform. The documentation also states that the lifecycle method onEnabled() is only called once.

According to the documentation the lifecycle of the AppWidgetProvider class is managed by the Android platform. The documentation also states that the lifecycle method onEnabled() is only called once. But how about widgets that were removed because the Android platfrom reclaimed its memory? In that case when the widget is activated again (e.g. some intent was received, or some开发者_如何学Cone clicked on the widget), will the onEnabled() method be called again?


NO! Answer is Simple No. I have started working on widgets recently. and i have learned the basics and according to that . the onEnabled()is jst like onCreate Method whenever you close and reopen the widget/activity the onEnabled/onCreate method is called.

onEnabled(Context context) : Called when the first App Widget is created. Global initialization should take place here, if applicable.

Reference: http://www.developer.com/ws/article.php/3833306/Creating-a-Home-Screen-App-Widget-on-Android.htm

Thanks: Hopefully i Helped U. Dont Mark this Answer as Correct So that other also knows the correct Answer!

0

精彩评论

暂无评论...
验证码 换一张
取 消