Category Archives: Projects

Fragments, Tab Adapter, and Different Layouts

tabs_fragWhen using Fragments in tabs, the FragmentManager takes care of instantiating, retaining, and reusing Fragments.  The problem there is that a tag for a fragment is auto-generated.  If we want to reuse that exact Fragment in a different layout (like when the device is rotated), we need to extract the tag and use the same one when re-initializing.

The better way to do this is to create your fragment instance and tag yourself.  That way, you can easily get a reference to your fragment later from the fragment manager.

So essentially we need to replicate the inner workings on fragment pager adapter and explicitly add your fragment (and your tag).

Jake Wharton has a great code sample that demonstrates this for using a Fragment Pager Adapter.  Building off that, I combined the Fragment Pager Adapter code with a standard Tab Adapter.

Check it out on GitHub!

Border Wait gets mini UI overhaul

Border Wait Android app was my first app and it showed – basic ListView, simple icons, and a launcher icon I found from the web.

For my fantasy football app Draft Punk, I used a number of new UI patterns I had seen in the official Twitter App and read on the Android Developer’s blog including the dashboard and action bar.  The result was my best looking app to date and a number of positive user reviews mentioning the interface and graphics.

So after finishing Draft Punk, it was time to revisit the look, feel, and graphics of Border Wait.

Continue reading

Fantasy football drafter GUI

Drafter screenshot

Last football (fantasy) season, my league had a live draft.  I didn’t want to do the old magazines, web printouts, highlighter, scratch paper, etc deal,  so I decided to write a simple GUI that showed me the fantasy ranks from various online sports sites.  Of course, once a player is removed, I wanted to eliminate him from the list and see only the available players.

The end result was a nice Java Swing GUI football draft tool that had the following features:

  • View the rankings from a variety of sources
  • Hide/show taken players as the draft moves on
  • Add players to an interested in list
  • Add players to your team list
  • Sort by position, projected points, name, etc.
  • Search player rankings table.
  • View additional details about player in web browser from any source.
  • Operate a client/server mode, where 1 server drafter can hide players and all connected clients reflect those changes.

I opened sourced the project on google code:  http://code.google.com/p/ff-drafter/

I’m thinking bigger for next year with maybe some smarts thrown into the ranking algorithm.  I’d like to dynamically re-rank players based on the outcome of the draft.  Maybe this tool will one day turn into a mobile Android or iPhone app – so be on the lookout.

Burkard Keller Trees

I was reading through the blog “Damn Cool Algorithms, Part 1: BK-Trees” by Nick Johnson and I was intrigued about burkard keller tree structure. (http://blog.notdot.net/2007/4/Damn-Cool-Algorithms-Part-1-BK-Trees)

It allows you to quickly search a tree of words (or other Objects) to find matches within a specified amount of “closeness”.  It is a much more efficient way of searching a dictionary of related words used in a spell checker or search term suggester application.   I decided to implement the algorithm myself in Java and posted the result to google code:

http://code.google.com/p/java-bk-tree/