Can I change appwidget-provider XML 's android:initialLayout? How to do?

by Perry168 » Fri, 20 May 2011 09:30:39 GMT


Sponsored Links
 Hi all,

    Following was the appwidget-provider XML for my widget. About the
< android:initialLayout="@layout/sc1" >, how to change the "@layout/
sc1" value in activity(Java)? e.g. change the sc1 to sc2.
    From this , I hope my widget is more flexible to use different
layout.

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
        xmlns:android=" http://schemas.android.com/apk/res/android" ;
        android:minWidth="150.0dip"
        android:minHeight="150.0dip"
        android:updatePeriodMillis="0"
        android:initialLayout="@layout/sc1"
        android:configure="com.test.runningtest.Setting"
        >
</appwidget-provider>

Thanks a lot!

-- 



Can I change appwidget-provider XML 's android:initialLayout? How to do?

by Perry168 » Fri, 20 May 2011 09:30:39 GMT


 Hi all,

    Following was the appwidget-provider XML for my widget. About the
< android:initialLayout="@layout/sc1" >, how to change the "@layout/
sc1" value in activity(Java)? e.g. change the sc1 to sc2.
    From this , I hope my widget is more flexible to use different
layout.

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
        xmlns:android=" http://schemas.android.com/apk/res/android" ;
        android:minWidth="150.0dip"
        android:minHeight="150.0dip"
        android:updatePeriodMillis="0"
        android:initialLayout="@layout/sc1"
        android:configure="com.test.runningtest.Setting"
        >
</appwidget-provider>

Thanks a lot!

-- 


Sponsored Links


Re: Can I change appwidget-provider XML 's android:initialLayout? How to do?

by Mark Murphy » Fri, 20 May 2011 18:08:15 GMT


 Just use your desired layout on the first onUpdate() call of your
AppWidgetProvider. You cannot literally modify android:initialLayout,
or anything inside of a resource, at runtime.






-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books 

-- 



Other Threads

1. Troubleshooting----installing android plug in to eclipse

# From the dialog where you select the Update sites to visit, select
the checkboxes for both the ADT site, and the Callisto/Europa/Ganymede
Discovery Site (you may want to check Automatically select mirrors at
the bottom).
# Click Finish.
# In the Next dialog, select the Android Plugins.
# Now, expand the tree item of the discovery site. It seems that if
you don't do it, it doesn't load the content of the discovery site.
# On the right, click Select required. This will select all the
components that are required to install the Android plugin (wst, emf,
etc...).
# Click Next, accept the agreement, click Install All, and restart
Eclipse


you MUST check Automatically select mirrors at the bottom......

--~--~---------~--~----~------------~-------~--~----~

2. Problem Running My App

Hi, I've created an Android app on the Eclipse SDK, but when I try to
run it, the emulator opens but the app doesn't load. On the Eclipse
console, it says:

[2008-07-03 17:04:25 - VideoPlayer] ------------------------------
[2008-07-03 17:04:25 - VideoPlayer] Android Launch!
[2008-07-03 17:04:25 - VideoPlayer] adb is running normally.
[2008-07-03 17:04:25 - VideoPlayer] Launching:
org.apache.android.VideoPlayer
[2008-07-03 17:04:25 - VideoPlayer] Automatic Target Mode: launch
emulator.
[2008-07-03 17:04:25 - VideoPlayer] Launching a new emulator.
[2008-07-03 17:04:28 - VideoPlayer] New emulator found: emulator-
tcp-5555
[2008-07-03 17:05:13 - VideoPlayer] HOME is up on device 'emulator-
tcp-5555'
[2008-07-03 17:05:13 - VideoPlayer] Pushing VideoPlayer.apk to /data/
app on device 'emulator-tcp-5555'
[2008-07-03 17:05:19 - VideoPlayer] Failed to install VideoPlayer.apk
on 'emulator-tcp-5555': timeout

What's wrong?

--~--~---------~--~----~------------~-------~--~----~

3. Android security application developing in Boston

4. USB GPS

5. Can Android be easily ported to ARM11 MPCore?

6. problem in adding animation to imageview

7. image database