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. Uploading Files in Nexus One

I was trying to upload files (images) to my wordpress blog through my
Nexus One mobile phone, but it shows 'Disabled' all the time, whether
I use the flash upload or the regular HTML upload contorl. I even
tried the Mobile admin Wordpress plugin with the same results.

Is there any option to enable upload files to wordpress using my Nexus
One phone, some settings that I need to change maybe ?


Idan

-- 

2. problems using the Android Manifest Editor

I'm new to Android development, created a project following the
instructions at: http://developer.android.com/guide/developing/eclipse-adt.html

And have not yet touched the source. I am having trouble using the
Android Manifest Editor to set my application to be debuggable.

I open my project's AndroidManifest.xml with the Android Manifest
Editor, then I switch to the Application tab. In the Application tab,
the Application Toggle is set to define an <application> tag. Under
Application Attributes, no value is chosen for Debuggable. I change
Debuggable to be true. At this point, I would expect that the xml on
the AndroidManifest.xml tab would change, or that I could manually
force a regeneration of the xml, or that I could save the file.
However, the xml does not automatically change, I can't seem to find a
way to force regeneration of the xml file, nor am I able to save the
file (File->Save is grayed out).

The only other fields with values in the Application Attributes
section are:
Label: @string/app_name
Icon: @drawable/icon

Curiously, the Name field is blank -- should it be populated?

I can edit the xml by hand, add the appropriate attribute, and debug
the application on my Droid, but it seems like a functional Android
Manifest Editor might be useful later on.

The current contents of the manifest are below. I'm running on OS X
using Eclipse with the ADT plugin.

Eclipse Version Info:
Version: 3.5.1.r351_v20090810-0600-7r88FEoFI0WTo6Az-1qFRHm37ChJ
Build id: M20090917-0800

ADT Version Info:
0.9.5.v200911191123-20404

The Android SDK I downloaded was android-sdk_r04-mac_86.zip

Thanks in advance,
Mike

-- 

3. Gallery crashing when scrolling using trackball

4. Empty contact list after adding contacts via insert query

5. icons bigger than 48x48 pixels

6. Notepad tutorial revised with hosted database

7. uncaught timeoutexception in socket