Category Archives: Java

Android Tabs with interacting map and list views

Last tutorial, we wrote a simple app that displays two interacting list views in a TabActivity. In this tutorial, we will up the ante and add a MapView as the content of one of the tabs. Why again are we using multiple views in an activity instead of using a separate activity for each tab content? Remember, we want our tabs to be able to easily interact with one another, and keeping them as views allows us to handle the logic and interaction within one activity.

So, our goal in this tutorial is to have a list of geo coordinates and when we click on an item in the list, our map view goes to that location.
Continue reading

Android TabActivity with two list views

Often times when creating an activity with tabs, it’s easy to have a separate activity for the tab content.  However, things get tricky when those activities need to interact with one another.

So the solution is to create a tabactivity with views (instead of activities) as the tab content.  We see a very simple example of this in the official Android tutorial Hello, TabWidget.

In this tutorial, we will create a slightly more advanced application.  We will have two listviews as the content of a tabactivity and have them interact with one another (basically by clicking the items of one list view will add them to the second list view). 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/