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. Problem with viewflipper animations and drawing cache

Well, I solved the issues, including the image issue, by adding the
following line to the Theme
<item name="android:windowBackground">@android:color/transparent</
item>




-- 

2. Problem with TabActivity and ListActivity

Hi all,
I am having a problem.I want to explain in detail.
1)I am Having an TabActivity with 5 tabs. I loaded content as follows.
   class MainScreen extends TabActivity{
        public static TabHost mTabHost;
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.tab);

           TabHost mTabHost = getTabHost();

            mTabHost.addTab(mTabHost.newTabSpec("excercise")
                                
.setIndicator("excercise",getResources().getDrawable
(R.drawable.exr))
                                .setContent(new Intent(this,Excercise.class)));
            mTabHost.addTab(mTabHost.newTabSpec("graphs")
                                
.setIndicator("graphs",getResources().getDrawable
(R.drawable.graph))
                                .setContent(new Intent(this,Graphs.class)));
            mTabHost.addTab(mTabHost.newTabSpec("gymlocator")
                                .setIndicator("gym 
locator",getResources().getDrawable
(R.drawable.gym))
                                .setContent(new Intent(this,Gymlocator.class)));
            mTabHost.addTab(mTabHost.newTabSpec("my account")
                                .setIndicator("my 
account",getResources().getDrawable
(R.drawable.my))
                                .setContent(new Intent(this,Myaccount.class)));
            mTabHost.addTab(mTabHost.newTabSpec("Music")
                                .setIndicator("Music",getResources().getDrawable
(R.drawable.music))
                                .setContent(new Intent(this,Music.class)));

            mTabHost.setCurrentTab(0);
        }
tab.xml
------------
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout
        android:orientation="vertical" android:background="@drawable/
innerbg"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TabWidget
            android:id="@android:id/tabs" android:paddingTop="55px"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

        </FrameLayout>
    </LinearLayout>
</TabHost>

------------------------
And the Problem is If i want to start activity which is not specified
in tabhost in above Java code,it is going out of tabactivity.
ie.,It is not coming in tabactivity.

2)But i want to have all the activities under tabActivity.
   Please i nee dthe solution urgent.
  If any one knows please tell me .

I hope you i am clear with my problem.

-- 

3. Motorola Droid, OpenGL,...crash on glBindTexture

4. Problem with sqlite database

5. ParcelFileDescriptor from ZipEntry how??

6. what should take care when call APIs in Surface.java

7. required hardware features