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. Help with Random number generator

I'm very new to android and java, so I don't have a very good
understanding of how to work through certain problems other than
taking wild stabs here and there.

The problem i'm trying to overcome is generating a simple random
number between 1 and 9 from the click of a button and getting that
number to appear in a TextView.

This is what I have so far, but it always fails at the .setText()

public class AndroidRandom extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button b = (Button)findViewById(R.id.Button);

        b.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                                TextView a = 
(TextView)findViewById(R.id.Output);
                                long tim = System.currentTimeMillis();
                                Random random = new Random(tim);
                                int RandomNumber = random.nextInt(9);
                                a.setText(RandomNumber);
                        }
                });
    }
}

--

2. java.lang.IllegalArgumentException while parsing xml file

Just to eliminate a couple of possibilities, what threading technique are
you using: AsyncTask, Service, your own? I suspect the latter, dur to the
"java.lang.Thread.run" at the bottom of the stacktrace.

The focus of the problems appears to be where
de.stefandahmen.android.navtrack.helper.Trackpoint.getTrkptLat calls
java.util.AbstractList.subList. This could well be due to a threading issue.
Which threads have access to the list and how are they synchonized?

-- 

3. reminder applicatio

4. Multicast videostreaming

5. In the Gallery from Intent.ACTION_PICK, can I override the longClick?

6. how to get RSSI (to get bluetooth signal strength)?

7. Problem getting Bluetooth RSSI (Signal Strength)