Parse CSV files easily with JavaCSV

Though it is much more likely you’ll get your data via a json / xml feed, sometimes it becomes necessary in the course of development events to parse a CSV file.  If you find yourself in this situation, here’s a nice library that will make the process as painless as can be.

JavaCSV is a library born out of the .Net DataStreams framework.  It promises good performance, low resource usage, and near unparalleled scalability (I have yet to test them out on the last claim, but so far I’ve gotten good mileage from the library).  Usage is quite simple:  just grab the .jar from SourceForge, import it into your project as described in Adding an External .jar to your Project, and read your file via the CsvReader class.  Here’s a snippet where I’m reading a file from the /assets folder within an AsyncTask:

protected Integer doInBackground(Void...voids){
// load the .csv file from assets
try {

CsvReader fileReader = new CsvReader(getAssets().open("file.csv"), Charset.defaultCharset());
fileReader.readHeaders();
while(
fileReader.readRecord()){
String unitName = units.get("")

}
} catch (IOException e) {
// TODO Handle Failure to get file
}
return numUnits;
}

Got any libraries you’ve found really useful in your Android development?  Let us know in the comments or over at twitter @droidweb!

ActionBarSherlock Compatibility Library upgraded to v. 3.5.0

Developers rejoice! One of my favorite Android libraries to date has recently been upgraded to becoming evenmore awesome than before. Jake Wharton’s ActionBarSherlock library has been updated!

ActionBarSherlock is an extension of the compatibility library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.  It allows the easy addition of the action bar Android UI paradigm to applications without having to worry about compatibility with older versions of Android.  I am a strong supporter of this paradigm and try to use it whenever possible!

 

From his Google Plus:

Major updates in this version:

  • Completely redone menu and action item support. This has been backported from the progress made on ABS 4.0 and provides a much more stable and logical layout of action items and management of the menu.
  • The compatibility library base has been updated to r6. I have also re-added the *Compat classes that were duplicated by this library and marked them as deprecated.

Download the new version from http://abs.io/. The samples on GitHub and the Android Market will be rolling out this evening as well.

Updating your projects making use of the old library is ridiculously easy.  Just download the new library and any desired .jar files, add the library as a project to your eclipse setup, and replace the references in your project to the old libraries with references to the new libraries.

Do you have any experiences using the ActionBarSherlock Library?  Would you like to see a guide for how to get up and running on ActionBarSherlock?  Drop us a comment below or tweet us @droidweb!