Google Android Nexus Device Un-Brick

GoogleNexus

If you happen to brick your Google Nexus device you can always use stock ROM images [1] to revert it to a default and operational state. Package contains not only OS but also bootloader and radio firmware images!

I have bricked my device by installing custom firmware that messed partitions layout inside a Flash Memory. I have seen lots of people having similar problem of endless bootloader-loop. There is no need to send a device to a service when bootloader is operational. All you need is a stock firmware image from Google [1], USB cable, and fastboot utility from Android SDK. If you happen to damage a bootloader, then hardware manipulation at low-level is necessary over JTAG, I can help to recover your device in that case.. no worries :-)

[1] https://developers.google.com/android/nexus/images

Android: dynamic string processing

There are two easy ways to replace text on-the-fly in Android. This may be required if you want to insert some text/values into displayed text, or construct a data packet of some sort. Both require some code to replace given part of the string.

First is to use HTML/XML tags and then handle them with your own implementation of Html.handleTag(). Unfortunately, String conversion removes the tag in the background, so you need to escape < mark with &lt; in the string resource. This approach is good when you want to put variables inside a string and then process them later in one place using tag handling – that is when you want to have a tag handled at processing time – so you only change tags and one processing routine.

Second is to use Format Strings instead of XML/HTML tags. It seems simpler, faster, and evades hidden conversion problems. getString(resource, ...) works like a well known printf(string, ...). This approach is good when you want to process each string manually at runtime, but strings and variables are hardcoded.

[1] http://stackoverflow.com/questions/7899563/android-converting-between-strings-spannedstrings-and-spannablestrings/34556513#34556513