开发者

Share class between widget and activity in android

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜