Hacker News new | ask | show | jobs
by Nemisis7654 4481 days ago
Some things I would note:

* Do not use getBaseContext() like he does when he created the new Activity. Use getApplicationContext for most things (unless an Activity is required) as this is guaranteed to be the same throughout the lifetime of your application.

* For log alternatives, checkout Timber by Jake Wharton (https://github.com/JakeWharton/timber)

* I would suggest using the Build.VERSION_CODES when making the check against which version of android the device is (http://developer.android.com/reference/android/os/Build.VERS...)

1 comments

And if you want colored logcat in a terminal window:

    alias lc="adb logcat | sed -e $'s/^I.*/\e[0;94m&\e[0m/g; s/^D.*/\e[0;92m&\e[0m/g; s/^W.*/\e[0;93m&\e[0m/g; s/^E.*/\e[0;91m&\e[0m/g'"
Jake Wharton also has a neat fork of Jeff Sharkey's colored logout Python script which is pretty awesome:

https://github.com/JakeWharton/pidcat