Sunday, June 14, 2009

Android logs with ADT (LogCat)

The LogCat view is on by default in the Debug perspective. I noticed that even when I'm not debugging the view is getting updates from the application running in the emulator. I added the LogCat view to my Java perspective so I can see it anytime.

In the clip above, you can see that the LogCat view defaults in with the Problems, Console, and other views in the bottom-right. I like it there. The second column in the view shows the logging level; this level comes from the method called on the Log object. Here are the clips from my code that correspond to the 'I' messages.

Log.i("ListBuckets", "Setting up grid.");
GridView g = (GridView) findViewById(;
g.setAdapter(new ImageAdapter(this, mBucketsDb.fetchAllBuckets()));

Above, I used just a plain string for the 'tag'; this seems like the common approach in the Android sample code. Below, I went to my more normal use of using the class as the tag.

public void onCreate(SQLiteDatabase db) {
Log.i(BucketsDbAdapter.class.toString(), "Creating fresh database.");

To add the LogCat view to the Java perspective:
1. open the workspace that houses your projects
2. Window -> Show View -> Other...
3. expand the Android tree node and select LogCat

Wednesday, June 10, 2009

Ike learning to IM

Isaac is 8 now so he is anxious to get online. He started using Pidgin yesterday and he's doing great. Here's a clip - he's even using smiley's :)

Wednesday, June 03, 2009

sqlite3 cli

Android gets better and better! I had a few minutes tonight to take a look at my current Android app and wanted to check the state of the DB. Expecting to find nothing, I Googled sqlite cli android and found that there are 2 methods. Beauty.

Term in Emulator

I thought that this would be the coolest but it was actually a paid because the UID is not root. The end result is that there are annoying permissions issues. It was pretty fun to be able to use the Term to check the DB:

Shell via ADB

jjohnson:~ jjohnson$ adb shell
# cd /data/data/org.mrtidy.nb2db1/databases
# sqlite3 data.db
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> .tables
sqlite> select * from bucket;
0|testing 0|3|
3|testing 3|55|2009-05-0
5|testing null|66|