Are you sure that would work??? Remote views is just a collection of
actions. It has nothing to do with real widget's layout.

On Dec 7, 11:37 pm, ryan alford <[email protected]> wrote:
> I ended up figuring it out.  So it goes something like this...
>
> ==================
>
> int layoutID = 0;
>
> if (1 == 1)
>     layoutID = R.layout.Layout1
> else
>     layoutID = R.layout.Layout2
>
> RemoteViews views = new RemoteViews(context.getPackageName(), layoutID);
>
> AppWidgetManager gm = AppWidgetManager.getInstance(context);
> gm.updateAppWidget(new Component("myPackageName",
> "myPackageName.WidgetName"), views);
>
> =====================================
>
> When you get the RemoteViews object using the constructor, you will tell it
> which layout you want to load, then just update the widget using the
> AppWidgetManager.
>
> Ryan
>
> On Mon, Dec 7, 2009 at 4:30 PM, Justin Anderson 
> <[email protected]>wrote:
>
> > Are you using the PreferenceActivity and SharedPreferences to store which
> > layout the user wants?
>
> > The way I have my settings work is by launching my subclass of
> > PreferenceActivity.  When the user returns from that screen, the onResume()
> > method on my activity is called.  It is in that method that I read settings
> > from SharedPreferences and change display stuff...
>
> > You could check a value in the onResume() method to determine which layout
> > to display.  As for actually changing the entire layout, I'm not sure if you
> > can call setContentView() in that method or not.  If you cannot you will
> > have to use a LayoutInflater.
>
> > Hope that helps,
> > Justin
>
> > ----------------------------------------------------------------------
> > There are only 10 types of people in the world...
> > Those who know binary and those who don't.
> > ----------------------------------------------------------------------
>
> > On Thu, Dec 3, 2009 at 6:17 AM, eclipsed4utoo 
> > <[email protected]>wrote:
>
> >> Let's say that I have two layouts for a widget:  Layout1 and Layout2.
> >> The default for the widget is Layout1, but I allow the user to choose
> >> which layout they want the widget to be.  So if the user changes to
> >> Layout2, how do I programmatically change the layout to Layout2?
>
> >> Thanks
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Android Beginners" group.
> >> To post to this group, send email to [email protected]
> >> To unsubscribe from this group, send email to
> >> [email protected]<android-beginners%[email protected]>
> >> For more options, visit this group at
> >>http://groups.google.com/group/android-beginners?hl=en
>
> >  --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-beginners%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to