How to update widget layout

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

How to update widget layout

Postby blackgin » Thu Nov 05, 2009 2:23 pm

I need to update the layout and the text of my widget.. I tried specifying the updateMillis for example to 60000, but it does anything.. How can I resolve?
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Top

Postby blackgin » Fri Nov 06, 2009 8:56 pm

Wow, nothing..
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Postby qlimax » Sat Nov 07, 2009 6:24 pm

have you defined an appwidget provider xml? I guess you add there the updatePeriodMillis value...

then have you specified that in the receiver in the manifest?


your manifest should look like this:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6.      package="com.yourpackage.widget"
  7.  
  8.      android:versionCode="1"
  9.  
  10.      android:versionName="1.0">
  11.  
  12.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  13.  
  14.  
  15.  
  16.  
  17.  
  18. <!-- Broadcast Receiver that will process AppWidget updates -->
  19.  
  20. <receiver android:name=".YourWidgetClass" android:label="@string/app_name">
  21.  
  22.    <intent-filter>
  23.  
  24.       <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
  25.  
  26.    </intent-filter>
  27.  
  28.    <meta-data android:name="android.appwidget.provider"
  29.  
  30.                        android:resource="@xml/provider" />
  31.  
  32. </receiver>
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.     </application>
  41.  
  42.     <uses-sdk android:minSdkVersion="3" />
  43.  
  44. </manifest>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4

the provider xml should looks like this

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.   android:updatePeriodMillis="2000"
  6.  
  7.   android:initialLayout="@layout/main"
  8.  
  9. />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


then in your widget code that extends the AppWidgetProvider class you have to override the onUpdate method

in this method put your update stuff

hope it helps :?

cya :run:
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby blackgin » Sat Nov 07, 2009 8:29 pm

I said that updatePeridodMillis does nothing.. In fact searching on the web I found that it does not work on android 1.6..
My question was it exists another way to solve the problem?
Thanks for your response ;)
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Postby qlimax » Sat Nov 07, 2009 9:01 pm

man you are right... thanks for the warning...1.6 and updateTimeMillis are not friend.
I've to update my widget too...

I found something on google...

http://www.developer.com/ws/article.php ... ndroid.htm
http://www.developer.com/ws/article.php ... ndroid.htm

http://www.developer.com/ws/print.php/10927_3833306_1
http://www.developer.com/ws/print.php/10927_3833306_2

they speak some about AlarmManager..

I'm reading & trying...
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby blackgin » Sun Nov 08, 2009 10:24 am

Thanks man.. If you manage to obtain a correct behaviour please tell me :)
I'm trying too
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Top

Postby I_Artist » Sun Nov 08, 2009 5:39 pm

Wow, this is good stuff. The 'student' helping the 'teacher' :) You've got to love the synergy here.
The I_Artist

follow me on Twitter: @I_Artist
follow Android Development on Twitter: #androiddev

Show the world that you are an #androiddev, wear the badge http://www.twibbon.com/join/androiddev
User avatar
I_Artist
Developer
Developer
 
Posts: 33
Joined: Fri Oct 16, 2009 3:49 am
Location: St-Eustache, Quebec

Postby qlimax » Mon Nov 09, 2009 8:56 pm

I_Artist wrote:Wow, this is good stuff. The 'student' helping the 'teacher' :) You've got to love the synergy here.

:lol: who is who :?:

blackgin wrote:Thanks man.. If you manage to obtain a correct behaviour please tell me Smile
I'm trying too


I managed that to obtain the correct behaviour, i posted a solution on my website:
http://www.egsolutions.ch
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby blackgin » Mon Nov 09, 2009 10:59 pm

qlimax wrote:
I_Artist wrote:Wow, this is good stuff. The 'student' helping the 'teacher' :) You've got to love the synergy here.

:lol: who is who :?:

blackgin wrote:Thanks man.. If you manage to obtain a correct behaviour please tell me Smile
I'm trying too


I managed that to obtain the correct behaviour, i posted a solution on my website:
http://www.egsolutions.ch


Naturally you're the teacher XD

Thanks for the solution!
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 8 guests