Seems like there are other things going on if it takes 2 seconds.  On
orientation change, you can save data in onSaveInstanceState() to be
later retrieved in onCreate() which could possibly save some time.
Not that I would advocate it but you could cache the layout so it
doesn't need inflating again.

The nice thing about using xml is not having to think too much about
the layout.  You can stick your portrait in /layout and landscape mode
in /layout-land and the inflater will pick the right one.  The support
for a large variance of screen sizes, resolution, etc., makes using
xml worth it.

Cheers

On Nov 17, 11:25 pm, Eric Murtaugh <eric.murta...@gmail.com> wrote:
> ok o my program i prefer to make the layout in java but i was
> wondering is it more efficient to make it in xml? i dont wanna test
> both and see whats faster but it feels like when my program call the
> oncreate (which is where all my layout building code is) takes about 2
> secs to load, will loading a layout from xml be faster?
>
> also a second question, i know you can allocate two different layouts
> (one per landscape or portrait) but does it till rerun oncreate when
> you do this and rotate? i ask because im considering not using
> landscape at all in my app however it would be usefull in a few
> situations like text entry but is there a way to jump to lanscape
> without calling oncreate so it will load much faster?

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to