Rename files to lowercase

As you probably now, your application’s images that are in the drawable directory must be named in lowercase.

Unfortunately this is not true for the iPhone applications. A big portion of my job is to develop Android apps using resources from existing iPhone apps. In order to be quick and efficient, I wrote this bash script that renames all your files in your current directory to lowercase, creates a new folder named 2x (which contains the large images) and removes the @2x extension.

for i in `find .`; do mv -v $i `echo $i | tr '[A-Z]' '[a-z]'`; done
mkdir 2x
mv *2x.png 2x/
cd 2x/
for i in `find .`; do mv -v $i `echo $i | tr -d '@2x'`; done

Please have a backup before using it!

Share

Android vs Windows Phone

I wrote an article for yesterday’s BugSense blog.

Check it here!

I have been into Android development for over 4 years now, since the very start. I started working with the 1.0 emulator, that red rounded device,remember? Its image still reminds me of all the time I wasted, waiting for it to run the application I was developing. Since then, things in the mobile ecosystem have drastically improved and new players joined the mobile revolution. …

Share

UTF-8 encoding at post values with HttpClient

It took me a while to find out how, so I believe it will be useful for you too.

HttpClient client = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://urlhere.com");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("name1", "utfvalue1"));
nameValuePairs.add(new BasicNameValuePair("name2", "utfvalue2"));
UrlEncodedFormEntity formEntity = null;
try {
	formEntity = new UrlEncodedFormEntity(nameValuePairs, "UTF-8");
} catch (UnsupportedEncodingException e2) {
	e2.printStackTrace();
}
if (formEntity != null)
	httpPost.setEntity(formEntity);

...
Share