Android Resources + SQLite. || Pick a number, any number.

So, you have a nifty neat application that is storing data based on user input. You allow the user to choose a resource (an icon, maybe a sound file) to be stored with that data record. Everything is going great until you add new resources to your project. Suddenly the icons are mixed up, no longer the icon originally chosen. Welcome to the world of machine-generated code.

The solution is rather simple, just not presented anywhere in the Android docs. We’ll create an Enum that associates the Resource IDs with our own local IDs. This way, we can store the local IDs, so that the SDK can change the resource IDs as much as it wants. Full code for the enum is at the bottom.
Continue reading →

Using Flex for pushing data from BlazeDS to HTML

Here’s my presentation for December’s SeaFlexUG meeting:

Android DataServices – DB4O

You’ve been through the Notepad example, and you’ve seen my enhancements in the previous post.  But what if you don’t want to have to worry about schema updates and figuring out how to store dates/images/whatever in SQLite?  What if you just want to store your objects without all of the SQL-hassle?

Enter Object Oriented Databases.

OODBs are great for small and simple databases, letting you write the fun(ctional) code without the drag of SQL.  We’re not talking ORM or Hibernate, with cleverly-hidden SQL.  Just simple store(MyObject) and we’re done.

The source code is found in the same place as the DataServices and SQLite project:http://svn.hat6.com/hat6public/DataServiceExample/trunk.
For all of this wonderful functionality, we’ll be using DB4O.  They even have a page dedicated to Android, though the source they provide won’t build.
Continue reading →

Android DataServices – SQLite

You’ve made your way through the Android ‘Notepad‘ tutorial, but find yourself wanting more?  Maybe you want to deal with Typed Objects instead of all of these strings everywhere? While this code isn’t generic enough to paste into your app and use as-is, it is simple enough to adapt to your own typed objects.  Using the Interface described here makes it super easy to change the way you are storing your data, without having to refactor your app itself (imagine a hybrid online/offline storage, or as we’ll see in the next post, an Object Oriented DataBase[OODB]).

If you’d like to follow along in eclipse, source code is found here: http://svn.hat6.com/hat6public/DataServiceExample/trunk.
Continue reading →

Android DataServices

So, you have an Android app, and you need to store your data.  The Android ‘Notepad‘ tutorial will show you the basics of SQLite, and I’ve modified their code quite a bit for my DataServices example project.  The one thing I don’t like about their example is that the app itself knows that the data is stored in SQLite.  While it is just an example project, I feel it’s setting a very bad example.  So I’ve created a bit of abstraction and added an interface so that the SQLite implementation can be swapped in and out for any other storage service.

Below we’ll examine the IReminderDataService interface, which provides some basic data storage functionality.  I’ve implemented two different storage mechanisms: visit SQLite and DB4O posts for specifics.
Continue reading →

Android ItemRenderers – Updated

I’ve created a project for showing off ItemRenderers. Anyone can view it here:

http://svn.hat6.com/hat6public/itemRenderersExample/trunk

ItemRenderer With Just Text

ItemRenderer With Just Text

ItemRenderer With Icon

ItemRenderer With Icon

Introducing Android to the concept of ItemRenderers

Project With Source Now Posted, See: http://hat6.com/2009/11/27/itemrenderers-updated/

Coming from the Flex world, it’s strange not to see the idea of “ItemRenderers” in Android.  Customizing the way a List Item looks is much more manual than in Flex, so I’ve come up with a ListAdapter that allows for some of the flexibility/framework-ness that I enjoy in Flex.

I started from this tutorial and modified it to be more Flex-esque.  I’ve tried to keep things as simple and generic as possible.  This is my first draft, so it’s pretty bare-bones, but it does what is needed initially.
Continue reading →

Commits to Flex SDK

First one was an addition to the border, to ensure that borders were drawn with the correct radius:

http://bugs.adobe.com/jira/browse/SDK-16147

Second is just a tooltip fix, but EVERY fix committed is a testament to the power of Flex+Open Source!!!!!!!!

http://bugs.adobe.com/jira/browse/SDK-16475

Showing us your Flex Ninjatude

seattle09
Several of the guys @ the SeaFlex User Group started the BugQuash. Sign Up, or go crying home to mommy.

SeattleFUG Project: Extending the Code Jam Project

Last thursday a bunch of members of the User Group gathered around and decided that a good way to learn about new tech was to just do it, and considering that I am associated with a project that is very close to 1.0, and has set goals for 2.0, we decided to work on the ResourceLocator that was developed at the San Jose 2008 Flex 360 Charity Code Jam.

So, the code isn’t there yet, we’re waiting for 1.0, which should be finished in the next couple weeks. But I’ve invited all of the members that want to participate to take a look at the code, and if they get really excited about it, they can even contribute and fix one of the bugs that are still outstanding. This invitation is NOT restricted to my user group members, anyone can join, just contact me (dusty (dot) jewett -at- gmail (dot) com).

One thing I promised the members was a bit of guidance, so I’m linking to Laura’s Flex 360 talk about Mate. Unfortunately, the talk on Degrafa hasn’t been posted yet, but there are plenty of examples on the site.  AMFPHP has been around for a long while, but I’ve enjoyed Sephiroth’s tutorials. I’ll be explaining specific things in our user group meeting on the 13th, and while we don’t have the cool setup that Flex360 did, I should be able to come up with some sort of recording of it.