Category Archives: android

Learning how to tweak my Android devices to fit me

One of the reasons why I like working with the Android operating system is that you can build little tools that interact with the other apps on your system. It’s like the reason why I like Emacs, although Emacs lets you go ahead and redefine routines. Anyway. =)

So here was my motivation: When you share a recipe from the BigOven recipe app, it sends the URL instead of the text. This is inconvenient, so I wanted to make a small tool that extracted the URL and opened it in the browser. That way, I could pass it to Evernote and save the recipe for later searching.

Android stitches different applications together through the idea of an Intent. An application can send an intent to another application in order to get it to do something. It can broadcast an intent to notify other applications that have registered to receive that event. An app can also register to receive various events.

To add something to the Share menu, I needed to write a small application that receives and processes the SEND intent. After trying to figure out if I should use a BroadcastReceiver or a Service or whatever, I settled on using an Activity instead. I might extend this to let me select one of multiple URLs, or recognize phone numbers and things like that too. We’ll see.

Anyway, source. =)

Small steps forward!

Learning more about Android development

From Tuesday: I spent most of the long weekend learning about Android development by working on the MobileOrg for Android open source project. When it comes to learning new technologies, I like working on existing projects more than starting from scratch. There’s plenty of sample code to draw on, and there’s enough functionality to inspire me to think about how to tweak it to fit my needs.

The first two days were really slow in terms of progress. It took me a while to figure out how to build both MobileOrg and MobileOrgNG, and I blogged the instructions in case someone else needs them in the future. After I figured that out, I started fiddling with the settings menu. I made the system more consistent, updated the look and feel to the latest design guidelines, and learned a little more about how everything tied together.

I’m starting to feel more comfortable with Android development. There are still tons of things to learn, of course, but I’m getting the hang of where things are, what things are called, and how things flow together. It’s an amazing thing, feeling the concepts click into place. As you learn more things, the possibilities grow combinatorically.

I should take care of a few other tasks before I move on to the next steps. I have to prepare a presentation for the Quantified Self conference in September. It’ll be an Ignite-style presentation, which is good – clear constraints make it easier to put something together. I also want to do an annual review in preparation for my birthday on Sunday.

After I finish those tasks, what do I want to do next in terms of Android development?

  • I’d like to build a better browsing interface for MobileOrg. I like the way MobileOrgNG makes it easy to browse the Org file’s hierarchy.
  • I want to be able to capture information from other applications.
  • It would be awesome to be able to handle attachments, too.
  • Tasker integration for automatically capturing information, perhaps?
  • Org-contacts would be great.

If I have a year of days like this, I think I’ll be able to learn and do a lot.

How to build MobileOrgNG for Android

MobileOrgNG is kvj’s fork of matburt’s MobileOrg for Android. It has a better layout for large devices and a useful outline view, but doesn’t have some of the other features in the main branch. Here’s how you can build it in Eclipse.

In order to be able to get all the libraries you’ll need, install the Subversive SVN plugin for Eclipse.

  1. In Eclipse, click Help – Install New Software.
  2. Click on the dropdown for Work with and choose the update site for your Eclipse version (ex: Juno).
  3. When the packages load, type in Subversive to filter the list.
  4. Choose Subversive SVN Team Provider. You can choose other plugins as well.
  5. Click Next and proceed through the installation process.

Now you can check out the MobileOrgNG source code and other modules. MobileOrgNG is set up as an Eclipse project, so importing it is easier than importing the original MobileOrg. Here’s how to get MobileOrgNG:

  1. Copy the Git repository URI (ex: git://
  2. In Eclipse, click File – Import – Git – Projects from Git.
  3. Choose URI.
  4. The URI may automatically be detected from the clipboard. If it isn’t, paste it in.
  5. Click Next.
  6. Click Next again.
  7. Click Next.
  8. You should now be at the dialog called Select a wizard to use for importing projects. Choose Import existing projects and click Next.
  9. It should have detected the mobile-org project. Click Finish.

In addition to MobileOrgNG, you will also need the android-actionbar and android-file-dialog libraries. Here’s how to get android-actionbar:

  1. Go to and copy the Git repository URL (ex: git://
  2. In Eclipse, click File – Import – Git – Projects from Git.
  3. Choose URI.
  4. The URI may automatically be detected from the clipboard. If it isn’t, paste it in.
  5. Click Next.
  6. Click Next again.
  7. In the Local destination dialog, change Initial branch to honeycomb-support. Click Next.
  8. You should now be at the dialog called Select a wizard to use for importing projects. Click Cancel.
  9. Click File – Import – Android – Existing Android Code Into Workspace.
  10. Click Browse and choose the android-actionbar directory in your workspace. You can deselect the actionbar example if you wish.
  11. Click Finish.

Here’s how to get android-file-dialog.

  1. Go to and copy the SVN URI (ex:
  2. In Eclipse, click on File – Import – SVN – Project from SVN.
  3. Paste in the URI.
  4. Click Next.
  5. Eclipse should prompt you to normalize the URL. Click Yes.
  6. Click Browse. Choose trunk and click OK.
  7. Click Finish.
  8. Choose Find projects in the children of the selected resource. Click Finish.
  9. Make sure that Check out as a projects into workspace is selected. Click Finish.

Confirm that the libraries are detected.

  1. Right-click on the mobileorg-android project and choose Properties.
  2. Click Android and confirm that both libraries are detected. If not, you may need to remove and re-add them.

The Dropbox API key isn’t part of the source code, so you’ll need to apply for your own at . After you get the API key, add it to your project:

  1. Create a new Android XML Values file. I called mine secrets.xml.
  2. Right-click on the file and choose Team – Ignore.
  3. Add a string with the key dropbox_consumer_key and the value from the Dropbox webpage.
  4. Add another string with the key dropbox_consumer_secret and the value from the Dropbox webpage.

MobileOrgNG should now compile without errors.

Building MobileOrg for Android

If you want to use your Android device to work with your Org-mode files, there’s MobileOrg and there’s MobileOrg NG. MobileOrg seems to have more recent activity and more contributors, but NG has a more tablet-optimized layout and better support for navigating large files, so it would be good to apply some of the ideas from NG to the main MobileOrg project. Might be a useful way for me to learn more about mobile development.

Here’s how to build MobileOrg (the matburt version).

  1. Copy the URI to the Git repository (ex: git://
  2. In Eclipse, click on File – Import – Projects from Git – URI. This may autodetect the URI. If not, paste in the URI. Click Next.
  3. You should now see a list of branches. You can leave them all selected. Click Next.
  4. Check the box for Clone Submodules. This will make sure that the project’s dependencies are also checked out. Click Next.
  5. When you see the dialog called Select a wizard to use for importing projects, click on Cancel.

Because the .project file hasn’t been set up, you’ll need to import the project using a different wizard. However, there’s an Eclipse bug that can make this a bit of a hassle, so this is what you should do to get the projects set up in your system.

  1. Close Eclipse.
  2. Move the mobileorg-android subdirectory from your Eclipse workspace directory to a different directory that is not in your workspace.
  3. Start Eclipse again.
  4. Click on File – Import – Existing Android Code Into Workspace. Click Browse and choose the mobileorg-android folder.
  5. Click on Deselect All.Reselect the following:
    • com.matburt.mobileorg.Gui.OutlineActivity
    • library
    • com.twofortyfouram.locale.MarketActivity
  6. Click on Finish.

Now you should have a bunch of projects in your system. You may need to adjust the libraries and build paths.

  1. Right-click on the com.matburt.mobileorg.Gui.OutlineActivity project and choose Properties.
  2. Click on Android and confirm that both libraries are detected. If not, you may need to remove and re-add them.
  3. Wait for the libraries to be built. If you notice that the compiled JARs don’t have classes, doublecheck that the src folder has loaded the sources. Right-click on the src folder and choose Refresh in order to get the sources recognized by Eclipse.

Re-detect the Git connection by doing the following:

  1. Right-click on the com.matburt.mobileorg.Gui.OutlineActivity project and choose Team – Share Project.
  2. Choose Git.
  3. Check the Use or create repository in parent folder of project.
  4. Check the .git directory you’re using.
  5. Click on Finish.

I also had to remove some code from AndroidManifest.xml because you’re apparently not supposed to have more than one action in an intent-filter:

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 01c4f1e..9fc3eb1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -64,14 +64,11 @@
             android:theme="@style/Theme.MobileOrgActionbar" >
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
-                <action android:name="com.matburt.mobileorg.Synchronizer.action.SYNC_UPDATE" />
             android:label="Org View"


Hope that helps!

Tablet adventures: Using my TF700 as a second monitor with AirDisplay

UPDATE 2012-07-29: Hmm, I’m getting some weird mouse behaviour after disconnecting from AirDisplay. I’ll look into this some more tomorrow.

Multiple monitors are great for productivity. You can see more of what you’re working on. You don’t have to switch between applications. You don’t have to remember snippets as you move from window to window. I want to work with multiple monitors, but I don’t want to be confined to the desktop downstairs, or to take up valuable kitchen table space with an LCD.

At 1920×1200, the Asus Infinity TF700 tablet has a higher resolution than my laptop (Lenovo X220 tablet, 1366×768). The Air Display app ($4.99 in Google Play) makes it easy to set up a tablet as a second monitor for your Mac or Windows computer if they’re on the same wireless network.

I installed the app on my tablet, installed the PC version on my laptop, restarted my computer, and set up the connection. Now I can drag windows over or use keyboard shortcuts to move my windows to the tablet. I can touch the tablet to interact with my computer, although the hardware keyboard on my dock doesn’t work. The display has some lag, but it’s useful enough for reading references or checking websites.

Air Display sets my laptop’s graphics scheme to Windows Basic, which removes a lot of the fancy visual effects that Windows uses to make things prettier. It’s a small price to pay for the ease and portability of having a second monitor.


Air Display (Android, $9.99 $4.99)  – Looks like they increased the price!
Air Display from the App Store ($9.99) – for the iPad

Waking up with barcodes

I’d been looking for a wake-up alarm that was good at getting me up and out of bed. It turned out that I can solve a sequence of two-digit addition problems while half-asleep, so my previous alarm clock app still tempted me to snooze.

For the past two weeks, I’ve been trying a different alarm clock app. Morning Routine requires you to scan a barcode or a series of barcodes in order to turn off the alarm. After reading a Lifehacker post that mentioned it, I downloaded the app and set it up on my phone. I configured Morning Routine to require the barcode of a tub of cream cheese from the fridge. It turns out that the process of stumbling out of bed, stepping around the cats in the hallway, and opening the fridge is enough to wake me up and get me to start making breakfast.

The app doesn’t have a snooze button, so I can either wake up properly or shut down my phone. So far, I’ve been good at not shutting down my phone.

The developer’s blog post describes an even more fleshed out routine that involves barcodes in several rooms, with timers to get through the process. My morning wake-up-and-get-out-the-door routine typically takes an hour, but it might be interesting to set timers for the different components, or do a low-level time study of it. Hmmm.

Morning Routine is an Android app, and it’s currently available for free. Check it out in the Google Play store!