Archive for September, 2009

I have 8 Google Wave invites.  To get one state what you are working on and your gmail account address as a comment to this post. I apologize in advance that I can only awadr 8 as I know that I will get many responses from hard working android developers. I only ask that if invited that you be willing to use your invites to invite more Android developers. I will send them out sometime around Friday evening.

Reblog this post [with Zemanta]

First, that working book title is not set in stone. Second, the book proposoal submission review is Tuesday morning. Third,  the publisher if they grant approval is Apress. Sevral of my peers  have authored for apress before and thus I feel its a good fit if I get the approval.

One  of the benefits of course, to you the reader, is that the code examples for the book will be previewed here at this blog and of course coding tips.

Reblog this post [with Zemanta]
Image representing Google Web Toolkit as depic...
Image via CrunchBase

It might get interesting in the next few weeks. I am reconsidering completing a book proposal for Android Webview Programming using Google Web Toolkit. It is a publishing company I trust while the advance is low the other opportunities that it could produce are somewhat bigger. Some of my online firends/peers have also authored programming books for this publisher.

Reblog this post [with Zemanta]

Android-GATE-09

Posted: September 28, 2009 in Android, Java, Mobile
Tags: , ,

I have resisted the temptation to weigh in on this as I wanted to see what would come to be., I see signs of developer efforts to assist the ecosystem, OMEs, OHA members, and etc in the process of the balance between an open Mobile Operating System Platform and business concerns of all parties. The response from develoeprs has been overwhelming in the desire to push forward in amign the Open Android OS platform work. But what point may have been missed might also be important.

Let me preface this with the point that the Google Engineers, HTC Engineers, T-Mobile  personnel, Motorola Engineers, and other OHA member Engineers on the Android Developer lists have been extremely good about communicating with outside developers. In my own case of developing AndCooper Android Java ANT-based tool and some Android Project contributions I always get answers I need and always am able to pick up new valuable information about Android OS internals.

However, at times there is a large disconnect in communication levels  above that development layer a times. At times it make sit as far as an outside developer who does develop applications and does contribute back code to the Android  Project feel like I am driving a racing car whose windows are  in darkness effectively driving blind. Some of that missing communication cannot be helped. However, the out pouring of the desire to help over the weekend should indicate to all OHA members that the power to help grow that Android OS ecosystem and project code remains a untapped reource if communication above the developer layer continues to have ‘disconnections’

Reblog this post [with Zemanta]

As you might know android-src.jar for IDE code completion is not supplied by the SDK you download.  SOmeoen has stepped up agin and suppplied a zipped archive of classes for SDK 1.6.  As always download from the link on bug issue 979 and unzip in /sdk_install/platforms/1.6/sources and of course you will alos find the download link for Android 1.5 zippede file of classes on the same bug issue report.

Reblog this post [with Zemanta]

Now I have an integration decision with AndCooper Android Java Application ANT based build tool. With the webview web code suport in the build tool my diea was at some point to swtitch to Goolge GWT compiler support and keep the non GWT  web tooling support there for those who wil not use Google GWT. The key question is do I make a separate project just for GWT and feed it in or a new set of directories and ANt script code to support GWT JS  generation in the main Android project.

Seems to me that is should be part of the overall Android Project structure and plus if I were say secretly working on a an Android application using Motorola CLiQ-Motorola Blur APIs and the Google Maps APIs it would seem that the Google GWT tooling would be an ideal component in that development work-flow.

Reblog this post [with Zemanta]

Sometimes it helps to read the fine print for example, adb:

You can use the adb commands pull and push to copy files to and from an emulator/device instance’s data file. Unlike the install command, which only copies an .apk file to a specific location, the pull and push commands let you copy arbitrary directories and files to any location in an emulator/device instance.

combined with startMethodTracing(‘tracefileName’)  and  stopMethodTracing() and dumpHprofData(‘filename’) can make debugging using an ANT build script a whole lot easier and more fun. And there is some more interesting stuff in the android.os.debug class. For example buffer size of *.trace files defautls to 8 megs so one could supply a higher buffer size amount for the startMethodTracing() calls. Basically, what yu can o dis have the *trace fiel created with startMethodTracing() and the  *hprof file created with dumpHprofData() named by by the moethod as you are calling those debug statements within your method. You woudl set it up so that you have a new dirsuch as:

startMethodtracing(‘/sdcard/trace/methodName.trace’);

dumpHprofData(‘/scard/hprof/methodName.hprof’);

Then its simple manner to do an:

adb pull /sdcard/trace /userhome/project/trace

adb pull /sdcard/hprof /userhome/project/hprof

..which of course makes it a lot easier. And since android.os.Debug is a wrapper on VMDebug lets check that class for juts a second and see what other goodies we can find.  Ah aha!

startInstructionCounting(), stopInstructionCounting(), and getInstructionCounts() leap to focus. Why? If you have constructed any thing involving memory or process time such as mathematics library, a graphics library, or a game engine you are in the mobile space attempting to optimize of the last amount of executed instructions. Having ways to log the amount of instructions a method might use to the log file becomes somewhat important. In this case to get access to call you need to use dalvik.system.VMDebug as its public.

Reblog this post [with Zemanta]

Android API Level Detection

Posted: September 24, 2009 in Android, Java, Mobile
Tags: ,

A comment made by had working Xavier(one of the Google engineers) yesterday got me thinking, API Level dtection using ANT,  before today’s regex refactoring:


<var name="var.api.level" value=""/>
 <if>
 <equals arg1="${target}" arg2="android-1"/>
 <then>
 <var name="var.api.level" value="1"/>
 <fail message="this build script version cannto be used with Android 1.0 "/>
 </then>
 <else>
 </else>
 </if>
 <if>
 <equals arg1="${target}" arg2="android-2"/>
 <then>
 <var name="var.api.level" value="2"/>
 <fail message="this build script version cannot be used with android 1.1"/>
 </then>
 <else>
 </else>
 </if>
 <if>
 <equals arg1="${target}" arg2="android-3"/>
 <then>
 <var name="var.api.level" value="3"/>
 </then>
 <else>
 </else>
 </if>
 <if>
 <equals arg1="${target}" arg2="android-4"/>
 <then>
 <var name="var.api.level" value="4"/>
 </then>
 <else>
 </else>
 </if>
 <if>
 <equals arg1="${target}" arg2="android-5"/>
 <then>
 <var name="var.api.level" value="5"/>
 </then>
 <else>
 </else>
 </if>
 <if>
 <equals arg1="${target}" arg2="Google Inc.:Google APIs:3"/>
 <then>
 <var name="var.api.level" value="3"/>
 <propterty name="template.google.maps" value="true"/>
 </then>
 <else>
 </else>
 </if>
 <if>
 <equals arg1="${target}" arg2="Google Inc.:Google APIs:4"/>
 <then>
 <var name="var.api.level" value="4"/>
 <propterty name="template.google.maps" value="true"/>
 </then>
 <else>
 </else>
 </if>
 <if>
 <equals arg1="${target}" arg2="Google Inc.:Google APIs:5"/>
 <then>
 <var name="var.api.level" value="5"/>
 <propterty name="template.google.maps" value="true"/>
 </then>
 <else>
 </else>
 </if>
 <if>
 <equals arg1="${target}" arg2="Motorola Inc.:MB200:3"/>
 <then>
 <var name="var.api.level" value="3"/>
 </then>
 <else>
 </else>
 </if>

Of course it does use the ant-contrib ant task library. Now to refactor using regex patterns. Basically by setting the var.api.level property I can than using flas load the correct code templates at project initialization for example MapView WebView, and etc. I can use the ant-contrib task  propertyregex to select the API level and do some condition testing to only pick the non null value between two regex filters.

Reblog this post [with Zemanta]

When working with new innovative technologies you often have to take apart old tools and gleu them back in new ways to deal with new issues. If you have worked in JavaMe(j2ME) before you might have used something like JReleaseInfo to adjust and collate different manifest items to add to the manifest before you jar’d it such as the build number. However, in the Adnroid Java Application development world the manifest is no longer an *.Mf file but an XML file and thus the version number we have to change upon calling an ANT task such as build number is in that file.

I came up with:


<!-- Set build number -->
<condition property="build.number.property.set">
<available file="build.number"/>
</condition>
<if>
<equals arg1="${build.number.property.set}" arg2="false"/>
<then>
<!-- We know build.number will set to 1 at <buildnumber/> call
-->
<buildnumber/>
</then>
<else>
<!-- Set var build.number.initial to build.number-1 -->

<if>
<equals arg1="${build.number}" arg2="1"/>
<then>
<!-- do not change AndrodManifest -->
</then>
<else>
<!--- okay do our repalce thing on AndoridManifest.xml -->
<property name="android.version.code" value="android:versionCode="/>
<property name="android.version.name" value="android:versionName="/>
<replaceregexp file="androidManifest.xml"
match="android:versionCode=(.*)"
replace='${android.version.code}"${build.number}"'/>
<replaceregexp file="AndroidManifest.xml"
match="android:versionName=(.*)"
repalce='${android.version.name}"${build.number}.00"'/>
<buildnmuber/>
</else>
</if>
</else>
</if>

The way I came up with is:

1. check to see if build.number file exists, rember the build.number property is incremented from zero to 1 on first <buildnumber/> ant task call.

2. if false than cal <buildnumber/> task

3 if true than check to see if build.number is 1 and if so do not change AndroidManifest.xml and if not change to relfect new build number.

Reblog this post [with Zemanta]

Motorola MB200 Add-on

Posted: September 23, 2009 in Android, Java, Mobile
Tags: ,

It is not bad as Motorola’s version 2 of the MB20 handset add-on for the Android emulator. However, no Motoblur enabled this time and no search enabled. I guess we might have to wait for October or November for those features to be enabled in the emulator add-on. Here is hoping that other handset OEMs follow up with their own Android Emulator Ad-ons soon.

Reblog this post [with Zemanta]