> > Not necessarily - contexts sometimes get nested (wrapped) as other > contexts with theme customizations applied in the process. > > Just to give an example, loading an item for a ListView inside a dialog on > 2.* will produce wrong colors if you don't use a wrapped context / inflater. > > Another place where context / theme wrapping takes place is the action bar > code. > > Yet another example: if an app sets themes on its activities dynamically, > it's entirely possible to have the (let's pick one) dark theme in the > application context, and a dynamically set light theme in an activity. > Loading textviews with the wrong one will result in unreadable text. >
Good points... I have never done these things and was unaware of these cases. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, Aug 28, 2012 at 4:07 PM, Kostya Vasilyev <kmans...@gmail.com> wrote: > > 2012/8/29 Justin Anderson <magouyaw...@gmail.com> > >> To load assets or resources you need to use the Application context... >>> >> >> I read that and realized this was wrong... I meant to say that as long as >> you are only loading assets or resources then you would be perfectly fine >> using the application context > > > Not necessarily - contexts sometimes get nested (wrapped) as other > contexts with theme customizations applied in the process. > > Just to give an example, loading an item for a ListView inside a dialog on > 2.* will produce wrong colors if you don't use a wrapped context / inflater. > > Another place where context / theme wrapping takes place is the action bar > code. > > Yet another example: if an app sets themes on its activities dynamically, > it's entirely possible to have the (let's pick one) dark theme in the > application context, and a dynamically set light theme in an activity. > Loading textviews with the wrong one will result in unreadable text. > > -- K > > >> (but you don't need to if you have another way to get a context). The >> application context should not be used for anything having to do with UI. >> >> >> Thanks, >> Justin Anderson >> MagouyaWare Developer >> http://sites.google.com/site/magouyaware >> >> >> On Tue, Aug 28, 2012 at 3:14 PM, Justin Anderson >> <magouyaw...@gmail.com>wrote: >> >>> To load assets or resources you need to use the Application context... >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en