Archive for July, 2010

In Android Java Applications we use a logging system to record log events including errors, debugging, etc.
Log levels are:

Verbose 2
Debug 3
Info 4
Warn 5
Error 6
Assert 7

The default log level set by the Android OS is 4 and above. Its the reverse for the levels of detail
in that verbose is the most detailed log level you can use. And debug is compield but stripped out
at runtime and obvoously you do not want Verbose triggered in your producition application.

At bare minimum to get debug and verbose to show you have to set it, which you can do via:

$adb setprops log.tag. DEBUG

Quick question, if you do this what log levels show in logcat? The log level you have sset and
everything above that log level shows in logcat. Thus if you want everything to show you set Verbose log level.

Okay so where does it show up? The Android OS by default logs to logcat four ‘log streams’;

Main
Radio
Events
System

Logs of levels Verbose through Assert are sent to the Main Log stream, in other words all application logging.

Thus, how do we prevent verbose and debug from being triggered in the produciton application but have it
triggered in the application we are debugging without changing any code?

You wrap the log calls with isLogable, for example in log wrapper class:

public static void debug(final Class myClass, final String tag,
final String msg) {
if (Log.isLoggable(tag, Log.DEBUG)) {
Log.d(tag, myClass.getSimpleName() + “:” + msg);
}
}

In this case if setprops is not used to set either Verbose or debug than log debug never gets executed
because android OS defaults to INFO log level and above if not set via setprops. if you use log calls
wrapped by isLoggable than you never have to worry about removing log calls to Debug or Verbose
as the isLoggable if statements ensure its not executed if not set to Loggable.

One of the best coding practices for Android Java Application Development is code wrapper classes that
make your code development easier by saving steps. Cdoing a log wrapper class should one of your
first steps in best coding practices.

Enhanced by Zemanta

AAPT overlay error-Linux

Posted: July 12, 2010 in Android
Tags:

If you are on Linux, when Google updated the SDK in May they did a soft update that did not change the revision version to correct an aapt on Linux. To get rid of the error go into the avd manager and delete 1.5 and 1.6 and instruct the avd manager to download and install them again.

Good morning and welcome to the beginning of the Android ‘Land-grab’. Some useful tools:

1. OpenNCF has published their sdk for andorid and an android add on at:

http://sourceforge.net/projects/open-nfc/files/

2. The AppInventor site went live:

http://appinventor.googlelabs.com/about/

Its a visual programming tool to develop android applications.

3. OpenFrameworks has released an android version for NDK development:

http://www.openframeworks.cc/setup/android-eclipse

4. Mark Murphy has released an Android Jar library tool called AndParcel that makes it easier for Androdi Jar Library deployment for those who do not use the Eclipse IDE and Gogle ADT combination at:

http://andparcel.com/

Enhanced by Zemanta

TranquilityBase

Posted: July 5, 2010 in Android, Java
Tags: ,

Game name is changed to TranquilityBase, I still have to add the input pipe-line features. And what do we do about sound?

Yes, its true that the moon had no atmosphere to give sound to the engine thrust shock waves. Mars has an atmosphere, not dense as ours but there is one.

Thus, the sound should be louder than the popping sounds you have heard form the lunar lander on moon audio tracks when the lander took off back to the command module.

And I did some code cleanup.

Enhanced by Zemanta

Elon Lander

Posted: July 2, 2010 in Android, Java
Tags: ,

This is what the Lunar Lander sample looks like with some code and UI cleanedup. Notice that I took off the game start, stop, pause, resume functions from the options menu.

But it could be better as there s no input pipeline example and touch events are not even integrated within the game.

I will probably end up coding a input pipeline and touch integration and contributing that back to the Android Project.

Than re-do the code as Rokon2d game engine 2.0 game as Rokon2d Game engine version has a physics engine as native code and some other new features.

Enhanced by Zemanta

GoogleMe in Gingerbread?

Posted: July 2, 2010 in Android, Java
Tags:

With all this talk about a probable FB competitor named GoogleMe the proof would be a GoogleMe connector in Android 3.0. I have yet to see anything, of course it still may hidden at the moment.

Like I never complain, right? While I appreciate the hard work every Android OS contributor has put in thus far some of the android code samples leave a lot to be desired. Code style mess-ups like if statements without brackets, parameters not finalized, etc. Still using the old test sub-folder in project instead of separate test project way of testing.

I can understand if we are not using modern IDEs.  But are we not using Eclipse, IDEA, NetBeans, etc? Well did we not have time considering that these code samples are supposed to show correct coding techniques?

Guess how long it took to clean up the LunarLander code project using properly set tools to get it to actually run on a device and emulator? Now, I have not completed the text code project yet but it was only one hour.

Yes, I am putting some  at github in the month of July. We have to have more professional code samples. The code samples in the SDK are just as important as the outstanding behind the scenes UI work that is occurring for Android 3.0 release in October.

Enhanced by Zemanta