[android-developers] Re: Shared preference from non activity class
I'm not happy with the other answers, though they are not really incorrect. (The object with a hashmap of properties thing that Hari mentions is not really a JavaBean, though some packages can use maps as if they were implicitly a JavaBean). I'd rather explain it from a minimalist point of view. A JavaBean is, at a minimum, an object with data that you access with public getter and setter methods. e.g. public void setFoo(String foo) and public String getFoo() -- although it doesn't need to be strings. This corresponds to a String- valued property named 'foo'. There's more layered on that, in terms of facilities to manipulate and work with them, but when someone says bean class, that's all you really know they're talking about. That's enough to be a JavaBean. On Jan 22, 4:50 pm, TreKing treking...@gmail.com wrote: On Sat, Jan 22, 2011 at 1:26 AM, Deeps pradeepb...@gmail.com wrote: I want to get shared preference from non activity class. Pass a Context, the SharedPreferences, or the value itself from somewhere higher up that has this information. I want to create a bean class to get and set the shared pref. I have no idea what a bean class is. --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
[android-developers] Re: Shared preference from non activity class
I have no idea what a bean class is. Bean class is an old name for awhat we call not a POJO. Android essentially leaves only the PropertyChangeEvent, from the old java.beans package. On 23 янв, 02:50, TreKing treking...@gmail.com wrote: On Sat, Jan 22, 2011 at 1:26 AM, Deeps pradeepb...@gmail.com wrote: I want to get shared preference from non activity class. Pass a Context, the SharedPreferences, or the value itself from somewhere higher up that has this information. I want to create a bean class to get and set the shared pref. I have no idea what a bean class is. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
[android-developers] Re: Shared preference from non activity class
Hi Hari. Just my two cents but if you mean the Java Bean specification, then the spec is a J2SE technology ( http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html ) and comes into world long before the people start to thinking in terms of EJBs and so on. Good luck ! Frank On 23 Jan., 02:24, Hari Edo hari@gmail.com wrote: On Jan 22, 7:50 pm, TreKing treking...@gmail.com wrote: I have no idea what a bean class is. It's one of those J2EE things that they shove at you in diploma-mill university IT classes. Basically, an object with a hashmap of properties, so that it's trivial to make GUI front-ends that can manipulate the properties directly. While I haven't weaned myself off all of the Collections classes, I'd say heavy Beans and lightweight Android are at diametric odds with regard to garbage collection stressors. -- 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
Re: [android-developers] Re: Shared preference from non activity class
Bean class is a pojo. You have private instance variables, with public get/set methods. A property is an instance field with a get/set method. I forget though if you need both.. there are some cases where you may want to make a mutable property by using a constructor to set it, then only have a getter so it can't be changed. On Sun, Jan 23, 2011 at 11:52 AM, FrankG frankgru...@googlemail.com wrote: Hi Hari. Just my two cents but if you mean the Java Bean specification, then the spec is a J2SE technology ( http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html ) and comes into world long before the people start to thinking in terms of EJBs and so on. Good luck ! Frank On 23 Jan., 02:24, Hari Edo hari@gmail.com wrote: On Jan 22, 7:50 pm, TreKing treking...@gmail.com wrote: I have no idea what a bean class is. It's one of those J2EE things that they shove at you in diploma-mill university IT classes. Basically, an object with a hashmap of properties, so that it's trivial to make GUI front-ends that can manipulate the properties directly. While I haven't weaned myself off all of the Collections classes, I'd say heavy Beans and lightweight Android are at diametric odds with regard to garbage collection stressors. -- 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.comandroid-developers%2bunsubscr...@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
[android-developers] Re: Shared preference from non activity class
On Jan 22, 7:50 pm, TreKing treking...@gmail.com wrote: I have no idea what a bean class is. It's one of those J2EE things that they shove at you in diploma-mill university IT classes. Basically, an object with a hashmap of properties, so that it's trivial to make GUI front-ends that can manipulate the properties directly. While I haven't weaned myself off all of the Collections classes, I'd say heavy Beans and lightweight Android are at diametric odds with regard to garbage collection stressors. -- 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