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. Unicode support

Is there a document that lists the range of  unicode codes that
Android supports.

I am trying to display  superscript 9 is \u2079 in a string and I get
a block in the emulator.

Superscript 3 which is \u00b3 works

Thanks
--~--~---------~--~----~------------~-------~--~----~

2. Force Roaming with ServiceState class?

I'm trying to force Roaming on my Sprint Hero... the standard options
in are "Sprint Only" and "Auto".

My area is mostly Verizon and I'd like to have a toggle to use only
roaming...

I'm trying to use this:

import android.telephony.ServiceState;

        ServiceState ss = new ServiceState();
        ss.setRoaming(true);

The get methods return valid information, but my set method doesn't do
anything.

This is my 1st attempt with Android.. .so maybe I'm missing a
listener... or maybe I need to get a handle off the current system
somehow?

Thanks for any tips!

Eric

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

3. AnimationDrawable programmatic example

4. AlertDialog won't disappear immediately when calling dismiss()

5. Error when starting the AVD

6. How to make a child activity?

7. need tester for an android app