Greg Hedin wrote:
> Are activity classes generally ugly or is there a common way that pro
> developers compartmentalize things in their activity classes?

I code in Ruby when I'm not working on Android. All Java code is ugly. ;-)

There are many patterns you can use to help organize an activity. Here
are two that I use, for what that's worth:

1. I sometimes break out the code that binds data to Views for rows in a
ListView into a separate "wrapper" class, as described here:

http://commonsware.com/Android/excerpt.pdf

2. I tend to break out my listeners and callback objects into private
anonymous inner classes:

private View.OnClickListener onButton=new View.OnClickListener() {
        public void onClick(View thingThatWentClick) {
                // something almost intelligent here
        }
};

(then use button.setOnClickListener(onButton); in onCreate() or something)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Need Android talent? Ask on HADO! http://wiki.andmob.org/hado

--~--~---------~--~----~------------~-------~--~----~
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