Sunday, February 27, 2011

Good practices for an Android beginner

When I begin to learn some new programming language or framework, I used to search for the good and bad practices I should take into account. In this old post ( I recommended you the Google Application Android Dev Helper 2010. In this app, the first entry in Android section is a little guide for beginners, with good an bad practices for Android developers. Here you have a little summary of the good practices:

About beauty:

About generosity:

About ubiquity:

About utility & entertaiment
  • Create an app that solves a problem
  • Present information in the most useful way possible
  • Create games that are ground breaking and compelling

About Epicness
  • Don't be satisfied with good
  • Create unique solutions
  • Invent new paradigms
  • Leverage the hardware

I hope this is of your interest.

Wednesday, February 23, 2011

Protect your code

A short tip to finish the day. Do you know that when you publish your Android Application it's so easy to download and decompile it?. So everyone can use your code or even modify it to break your copy protection or any thing else.

So it is very recommended to compress and obfuscate your code. It is very easy, simply add the following line in your / file:


And if you use the Eclipse option Export Signed Application Package create by hand the /proguard directory.

The only precaution is to add the following line in proguard.cfg for every class you don't want to be obfuscate:

-keep public class 

Why don't obfuscate? Very easy, if the class must be accessed dynamically in runtime you cannot obfuscate it, otherwise you'll get an Classnofound error.

I hope this trick will be useful for you.

Thursday, February 17, 2011

Short Tip: Double version (free and paid)

Do you want to deploy to the Android Market to versions of the same application, for example one free and other paid?
Well it seems simple, but really it isn't, because Android identifies your application by the main package name. So many manual (or automated by a script) changes must be done to the source files every time you compile.
The most direct solution is to use the Proyect Library feature of the SDK: more
You can get more details: here.

Saturday, February 12, 2011

A short tip: Avoid rotation

If you want to avoid the screen rotate automatically, simply put:



In the definition view.

If you prefer the programatically option:



It's very simple, It isn't?