Taking a look at iosched open source app….

So, yes, open source is right, great and helps everyone to learn how to do right things (or even to just learn more about some framework).

This week I needed to look at the source code of two open source apps for Android: iosched and ubuntu one for android. They’re both pretty great and they deserve attention and take a closer look to their source code.

Now, I’m going to talk you about a nice implementation I found on IOSched app. The SinglePane pattern. I really didn’t find it very useful first time, but when you start using it, you find it really cool! It provides you a simple way to define Activities that just have one fragment for its content. Simple, uh?

Although this time, it extends from BaseActivity, you could extend from Activity, SherlockFragmentActivity, RoboSherlockFragmentActivity or whatever fits your project. Just take into account that It must be able to use fragments.

As you can see it’s pretty simple, you just have to extend this class and override onCreatePane() on your child activity.

In that simple method you just have create a new Fragment of your own, and you’re done! Do you want an example of how this can be achieved? It’s pretty simple too!

and this would be the fragment:

*That one is picked from iosched :P

Don’t forget that this simple pattern also provides passing extra to set a new title! Or you can use this two methods from BaseActivity to pass arguments from activities to fragments.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>