On Thu, Dec 15, 2011 at 9:31 AM, Adorilson Bezerra de Araujo
<[email protected]> wrote:
>
>
> On Thu, Dec 15, 2011 at 8:39 AM, hhenne <[email protected]> wrote:
>>
>> In java you don't have macros (#ifdef) = compiler instructions. In
>> stead you have to make a plain java function, which will do the same -
>> the only difference is, the macro will not generate a call instruction
>> - so it's more efficient.
>> Personally I use it a lot. It is nice, to be able to switch off
>> technical or business features by just changing a flag from true to
>> false. You can use it for having more versions for different
>> environments, for searching for nasty bugs, or for handling different
>> versions - alternative to branching.
>
>
> Do you means something like this:
>
> http://groups.google.com/group/android-developers/msg/08d80619492a2edf?hl=en
>
> ?
>
> If not, can you show us a piece of code?
>  or a link to a full code will be wonderful.
>

That and clever uses of interfaces, / overloading, etc...

http://stackoverflow.com/questions/6525059/can-i-have-macros-in-java-source-files

In general I agree that using a preprocessor in Java is a bad idea,
but I'm also flexible because of the weird changes that exist across
the many possible android builds running amok.. (i.e., in theory you
shouldn't have a hacky solution like this, and your design should be
neat and include interfaces which do things like check if certain
system features are available, but sometimes you just can't beat it..)

Kris

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to