Last weekend I participated in the statup weekend. I worked on the idea of Giuliano Iacobelli 'QuickJobs' developing the android application in half day.
Result: we won! ;)
Thanks to all the participants of the team!
Team:
Giuliano Iacobelli, Andrea Giannangelo, Leonardo Pellicciotta, Gabriele Pannacci, Cristiano Severini, David Funaro, Andrea Torre, Luca La Mesa, Stefania Nardo, Annalisa Puracchio, Fabio Lalli, Enrico Pellegrino
Tuesday, November 2, 2010
Wednesday, September 1, 2010
Detect if code runs into emulator
Working on my app i had needs to know if the code was running into emulator but Android doesn't have any API to detect it so i wrote a little function which returns 'true' if emulator is present:
ANDROID_ID is null on 'old' emulators, since 2.2 the id is always '9774D56D682E549C'.
Hope this help ;)
public static boolean isEmulator() {
String id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
boolean emulator = TextUtils.isEmpty(id);
if (!emulator) {
emulator = id.toUpperCase().equals("9774D56D682E549C");
}
return emulator;
}
ANDROID_ID is null on 'old' emulators, since 2.2 the id is always '9774D56D682E549C'.
Hope this help ;)
Sunday, July 18, 2010
What's wrong with my name?
After installing the Eclipse IDE and all Android's SDK components, I tried to create my first emulator. On Windows Vista and 7, the emulator disk images are created under your user's folder (C:\Users\UserName). After setting up all the required paths, I fired Eclipse and used the AVD Manager to create my first image of a 1.5 device. The creation process ran fine but the emulator refused to start, complaining about something related to path names (ERROR: no search paths found in this AVD's configuration). Apparently the path name for the AVDs cannot have UNICODE characters like mine has (C:\Users\João Paulo). The 'ã' seems to be confusing for the SDK... The solution is to create an alternate directory for your AVDs with proper naming and use the command line to create them:
android create avd -n HVGA-3 -t 1 -p d:\android\avd\HVGA-3 --force
Life's good now.
android create avd -n HVGA-3 -t 1 -p d:\android\avd\HVGA-3 --force
Life's good now.
Tuesday, July 13, 2010
Log your applications
Looking at Log class you can see the isLoggable method.
With that you can check if the 'TAG' used in Log is loggable, so you can write something like that:
in this way you can call the Log.d() ONLY if MyTag can be debugged saving time of execution.
To 'mark' MyTag as loggable in DEBUG (default is INFO) just call in terminal:
Happy debug! ;)
With that you can check if the 'TAG' used in Log is loggable, so you can write something like that:
if (Log.isLoggable(MyTag, DEBUG)) {
Log.d(MyTag, "Debug line");
}
in this way you can call the Log.d() ONLY if MyTag can be debugged saving time of execution.
To 'mark' MyTag as loggable in DEBUG (default is INFO) just call in terminal:
adb shell setprop local.tag.MyTag DEBUG
Happy debug! ;)
Tuesday, July 6, 2010
Subscribe to:
Posts (Atom)