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. Emulator not coming up.

Hi,

I have built the Android Master source code on Ubuntu 6.06. And the
emulator was working fine with all apps.
Suddenly the emulator is not booting up at all and gives the following
error.

*** buffer overflow detected ***: emulator terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xb7d34558]
/lib/tls/i686/cmov/libc.so.6[0xb7d32680]
/lib/tls/i686/cmov/libc.so.6[0xb7d31d68]
/lib/tls/i686/cmov/libc.so.6(_IO_default_xsputn+0xc8)[0xb7ca7a18]
/lib/tls/i686/cmov/libc.so.6(_IO_vfprintf+0xf4a)[0xb7c7a8da]
/lib/tls/i686/cmov/libc.so.6(/lib/tls/i686/cmov/libc.so.6(__sprintf_chk
+0x2d)[0x
b7d31d5d]
emulator[0x8091f79]

Please help.

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

2. Modifying the user interface of Android...possible?

Hi,

I am looking for some answers from some of the experts here. I have a
project in mind that I want to start. It is about using HTC's Touch HD
phone as a device in a museum with rich media/video about the art and
the artists on it. Besides the videos and animation, I also want to
show some content from a web browser. Now my biggestest issue. I do
not want that the museum guest who pick up the phone for the tour get
to see the standard Android user interface. Is there a way to develop
a new user interface that would start up directly once the phone is
turned on? It should then automatically start the app with the museum
infos. Later I may want to add some GPS functions and even sms and
photo taking, etc....

What do you think, how flexible is Android to allow that?

Any ideas highly appreciated.

Thanks
Matt

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

3. How to set my SMS application is default to read sms?

4. Weired bug when saving picture to file system!?

5. Problem with giving the SDK path in eclipse for SDK 1.5 pre in windows

6. Handler posts and threads after onDestroy

7. HTTPS connections through the browser, from within applications