开发者

Share class between widget and activity in android

开发者 https://www.devze.com 2023-03-22 18:59 出处:网络
I\'ll try to explain my idea: I have 1 widget with all his things(xml layout,widget provider...) Widget consists in one ImageView that updates every 24h.

I'll try to explain my idea: I have 1 widget with all his things(xml layout,widget provider...) Widget consists in one ImageView that updates every 24h. Also if user press on widget, it launch an activity. I want to have one class Counter.java that could be accessed from widget and from activity at same time. But I don't want to initialize that class each time I access on it. Just once to create. I dont' know when do it and where.

One more question:

How to detect the moment when Activity is started from widget. And when it comes back to 开发者_如何学编程widget?

0

精彩评论

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