How to update widget on view?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to update widget on view?

Postby qakker » Tue Jan 12, 2010 3:07 am

Hi, I want to create a widget that changes an image when the user sees it.

Anyone know how this can be done?

Many thanks for any help.
qakker
Freshman
Freshman
 
Posts: 2
Joined: Tue Jan 12, 2010 3:00 am

Top

Postby jwei512 » Tue Jan 12, 2010 7:12 am

When you say everytime the user "sees" it, do you mean everytime the phone screen turns on?
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Postby qakker » Tue Jan 12, 2010 1:59 pm

Yes. Say that it is on the home screen, then it should update some milliseconds after the user presses the home button. If it is on the second screen to the right, then every time the user scrolls to it there.

The app is a picture frame that updates with new pictures once a day, and shows a new one every time the user sees it.
qakker
Freshman
Freshman
 
Posts: 2
Joined: Tue Jan 12, 2010 3:00 am

Postby jwei512 » Tue Jan 12, 2010 7:33 pm

Doesn't seem like you can listen to when a widget is visible in one home screen or another (see http://www.mail-archive.com/android-dev ... 49947.html)

As for the screen waking up issue:

http://developer.android.com/reference/ ... ivity.html

From the docs it tells you that when the screen goes to sleep onPause() gets called, and when it wakes up onResume() is called so in your case you probably want to manually push an update to your widget in the onResume() method.

I haven't seen a wake up screen listener or intent of any sort so I'm curious to see if others have.
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests