Sunday, August 1, 2010

Re: [android-developers] Re: Android preprocessor, //#ifdef...

> I have had to learn to live without conditional compliation.  The only
> area where I really miss having a lanugage constuct like "#ifdef" is
> when I need to remove instrumentation and/or debugging code.

You can achieve this in Java using static final fields. The compiler
is smart enough to remove if block whose condition evaluates to false
at compile time (we use this a lot in Android's source code :).

--
Romain Guy
Android framework engineer
romainguy@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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

[android-developers] Re: Android preprocessor, //#ifdef...

I think most peoples opinion is that it just is not useful in java.
There have been numerous discussions about needing/not needing a
preprocessor in Java. You are not going to be #defining symbols (use
a static class), including files, using __FILE__ or __LINE ( use the
logging, no symbols means no ifdefing code (if (false) workes the
same as #if 0 ), macros for functions (ie make a class and use static
inline function). If you care to tell use the problem you are trying
to solve, some could probably suggest a solution that doesn't involve
macros. Im 15 years of Java, I have never missed them. Macros in the
build system on the other hand...

On Aug 1, 10:40 am, Leigh McRae <leigh.mc...@lonedwarfgames.com>
wrote:
> On 8/1/2010 4:29 AM, Mark Murphy wrote:
>
> > Java (J2ME, Blackberry, Android) does not have a native preprocessor.
> > Neither does Javascript for WebOS/HTML5 applications, nor Actionscript
> > for Flash/Flex/AIR applications. Neither do some languages drifting
> > into the mobile space (e.g., Ruby, and Perl AFAICT) for Android,
> > Meego, and Symbian.
>
> > It is probably more accurate to say that C and its derivatives (e.g.,
> > C++, Objective-C, C#) and .NET languages (VB, C#) have an integrated
> > preprocessor, and that those languages are widespread in mobile
> > platforms today.
>
> Preprocessing for j2me is supported by SUN via NetBeans.  It's pretty
> clear that SUN fully backs preprocessing for j2me if you look at all the
> support provided.
>
> BlackBerry preprocessing is fully supported via their compiler, rapc.
>
> What I don't understand is why so many people are against it.  It's just
> a tool and one that can get you out of a tight spot.  Give people the
> tools and let them cut their own toes or feet off.  Oh and yes I know
> what the reply will be.  Write it yourself, it's open source...  We
> aren't Java or we are Java depending on what we are debating...
>
> --
> Leigh McRaewww.lonedwarfgames.com

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

Re: [android-developers] Re: Shared library

2010/7/29 Kostya Vasilyev <kmansoft@gmail.com>:
> Make the library interface be intent-based, and there you have it.

Unfortunately in my particular case it is not going to work.

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

Re: [android-developers] Understand the filesystem contents

On 30 July 2010 01:15, John Manko <john.manko@gmail.com> wrote:
> Is there any documentation on the filesystem used for Android?  I'm
> talking about an explanation of the contents of /dev or /etc, and not
> YAFFS or whatever.

Android is Linux based so look for Linux directory structure explanation
which many on the web. In general /etc is commonly used
to store various system settings (of daemons, services etc) and /dev
refers to phisicial devices available in the system. This looks like a
read that could cast some light:

http://www.goitexpert.com/general/a-guide-to-linux-directory-structure--part-one/

You usually do not write access to these folders unless rooted and even
so, you may also not need that as playing with these may brick your
device if you do not know what are you doing.

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

Re: [android-developers] Re: Multiple concurrent versions of same app, filtered by minSdkVersion?

On 1 August 2010 19:25, Brian Rak <seattleniceguy@gmail.com> wrote:
> Thanks for the reply. The problem with making separate apps is that
> existing customers will not be able to upgrade for free. And the code
> refactoring idea doesn't work, because the main point of the exercise
> is that I want the new version to contain all those resource files in
> the .apk itself, which I don't want for the older version.

No luck then. However it would be quite useful if you could have more than one
APK per version depending on OS version, it's not going to happen. as Market
filters apps also based on other conditions (i.e. MMC, screen-size, etc, etc).
So it would probably be to complicated and most people simply do not need that.
You would solve your problem by releasing other APK with resources (however
it depends on what "resources" really means) and use it from your main app.
But if you would need to use sharedUserId (and you have not set it since
1st release) then you are again out of luck due to bugs in older
android versions:
http://java-hamster.blogspot.com/2010/05/androids-shareduserid.html

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

[android-developers] Re: allign text vertically in a text view

yeah it works ... thanks a lot paul...:)
hey Paul I have posted one more query regarding pinch in pinch out
zoom.... can u plz check and share ur idea on that and help me in
resolving it .. PLZZZZZZZ

On Jul 28, 12:50 pm, Paul Turchenko <paul.turche...@gmail.com> wrote:
> Yeah, no problem with that. Just declare you DemoView in the layout.
> For now it goes like this:
> <LinearLayout ...>
> <ImageView .../>
> <your.package.name.DemoView .../>
> </LinearLayout>
>
> And set this layout to be activity's content.
>
> On Jul 27, 1:32 pm, harshe <hars...@gmail.com> wrote:
>
> > Thanks Paul.....As u said, the following code works well . But it
> > looks like a custom view , i cant see the textview itself. I have set
> > the ContentView to main.XML only but still the views in the main.XML r
> > not seen. am getting an output were i can see only the given string
> > rotated -90 degrees in the specified location. i want this rotation of
> > the string to happen inside the textview and the other components in
> > the main.xml has to be displayed.....do i have to change anything in
> > this code And if i want to add an ImageView next to this textview
> > ( linear layout is horizontal orientation)
> > wat i should do. Please do help me........
>
> > public class textrotate extends Activity {
>
> >     DemoView dview;
> >         /** Called when the activity is first created. */
> >     @Override
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         dview= new DemoView(this);
> >         setContentView(dview);
> >        // rotateText("FACEBOOK");
> >     }
>
> >         private class DemoView extends TextView{
>
> >                 public DemoView(Context context) {
> >                         super(context);
> >                         // TODO Auto-generated constructor stub
> >                 }
>
> >                 protected void onDraw(Canvas canvas){
> >                         super.onDraw(canvas);
> >                         // x increases from left to right
> >                         // y increases from top to bottom
> >                         canvas.save();
> >                         //int x=0;
> >                         //int y=0;
> >                         Paint paint= new Paint();
> >                         paint.setStyle(Paint.Style.FILL);
> >                         paint.setColor(Color.WHITE);
> >                         //x=30;
> >                         //y=400;
> >                         paint.setTextSize(40);
> >                         String str2Rotate = "FACEBOOK";
> >                         float py = this.getHeight();
> >             float px = this.getWidth()/8.0f;
> >             //canvas.rotate(180, px, py);
>
> >                         canvas.rotate(-90, px,py);
> >                         canvas.drawText(str2Rotate, px, py, paint);
> >                         canvas.restore();
>
> >                 }
> >         }
>
> > }
>
> > On Jul 27, 3:33 am, Paul Turchenko <paul.turche...@gmail.com> wrote:
>
> > > Inherit from TextView, override measure pass and during draw, rotate
> > > the canvas, call super, restore it. This will do the trick
>
> > > On Jul 26, 12:38 am, harshe <hars...@gmail.com> wrote:
>
> > > > I have a textview placed vertically in an activity.. I Want the text
> > > > within the textview to be shown as bottom to top facing right side.
> > > > Can anyone please help me out..........
> > > > my XML file is
>
> > > > <TextView
> > > >     android:layout_height="200dp"
> > > >     android:layout_width="50dp"
> > > >     android:paddingTop="100dp"
> > > >     android:text="ALL"
> > > >     android:textSize=" 20px"
> > > >     android:autoText="true"
> > > >      android:paddingLeft="5dp"
> > > >      android:layout_gravity="fill_vertical"
> > > >   />

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

[android-developers] Re: Android preprocessor, //#ifdef...

My background is C and C++ ... 25 years and no longer counting :)

So I had some ingrained expectations when I started learning Java;
amongst them was the expectation that the Java language would support
conditional compliation.

I have had to learn to live without conditional compliation. The only
area where I really miss having a lanugage constuct like "#ifdef" is
when I need to remove instrumentation and/or debugging code. I now
write less of this type of code and try to remember to mark what I do
wite with a "remove me" comment, which gets picked up by the Eclipse
to-do list. I then remove it during my pre-QA code review.

I have yet to feel the need to use conditional compilation to deal
with the often quoted "platform fragmentation" as the differences in
the platforms mostly impacts the amout of time I spend testing and I
have yet to write ANY code that differs by supported hardware. Using
the resource qualifiers has been all I have needed to do so far.

I still don't like some aspects of the Java language (don't get me
started on GC based languages) but Android is much more than just a
language and writing off a complete platform for one feature you
consider missing is very strange position to take.

On Jul 31, 11:09 pm, sblantipodi <perini.dav...@dpsoftware.org> wrote:
> I'm sorry for my rude and really not too much kind speaking,
> but I can't belive that android doesn't support preprocessor.
>
> I can't think on mobile programming without preprocessor, too many
> different configurations,
> think only to LVL and android market and preprocessor could be
> useful...
> Ok we can live without it, but codes becomes really unelegant...
> Sincerely I really don't like the non preprocessor way but
> unfortunantly,
> masses told that android is good and I need to develop on it :)
>
> On Jul 31, 10:58 pm, TreKing <treking...@gmail.com> wrote:
>
> > On Sat, Jul 31, 2010 at 3:00 PM, sblantipodi
> > <perini.dav...@dpsoftware.org>wrote:
>
> > > How can you develop on a mobile without preprocessing?
>
> > Quite easily, actually.
>
> > > Sure android is really good for fart app, but what else?
>
> > Is this is a serious question? Have you browsed through the Android Market
> > (as painful as that is)? There's a lot more out there than "fart apps".
>
> > > I don't want to troll but I really can't understand why I heard
> > > many developers saying "viva android" when google released the first buggy
> > > SDK.
>
> > Probably simply because it's an alternative to iPhone.
>
> > Now, someone with your experience developing for so many devices can surely
> > adapt to not having a preprocessor. It's good for many things but definitely
> > not a necessity and will certainly not cripple you when making an Android
> > App.
>
> > If you're personally that attached to having a preprocessor, no one is
> > forcing you to develop on Android.
>
> > Good luck.
>
> > -------------------------------------------------------------------------------------------------
> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > transit tracking app for Android-powered devices

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