Question about Android GUI system

by Videoguy » Fri, 03 Apr 2009 21:17:31 GMT

Sponsored Links
 Just wondering why Android team decide to build GUI sub system not
based on java.awt framework. I understand Swing might be too big. But
underneath Swing, you got basic AWT framework that allows you build
your own  lightweight GUI frameworks.
The android.view classes could have been based off of
java.awt.Component (and Container etc). Instead they are built from
scratch without any reference to AWT classes.
I am wondering what the reason was behind this design.


Question about Android GUI system

by Fred Grott » Fri, 03 Apr 2009 21:29:21 GMT

 probably because AWTis pain in the but perhaps?


Sponsored Links

Question about Android GUI system

by Romain Guy » Fri, 03 Apr 2009 22:14:18 GMT

 Because AWT was not suited for the needs of Android.

Romain Guy
Android framework engineer

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


Question about Android GUI system

by Videoguy » Sun, 05 Apr 2009 01:57:34 GMT

 But why?
The core AWT lets you create your own toolkit (with look and feel of
your choice)and has a framework for event bubbling etc. The android
View is like Component, ViewGroup is like Container. The AWT Graphics
class is an abstraction to interact with drawing surface.
We built our own light weight toolkit on top of JDK 1.1 base AWT (plus
heavy weight components Frame and Window) for an embedded device.
Just curious as to why you decided to drop it?
Does hardware acceleration has anything to do with it?

I used to follow your blogs (and Chet Hase's) about java graphics
acceleration and opengl. You guys rock! I have your book too.

Thanks for answering my question.


Question about Android GUI system

by Dianne Hackborn » Sun, 05 Apr 2009 03:33:15 GMT

 sing AWT means you need to drag in a bunch of other stuff, from Bitmap and
elsewhere, that are not necessarily appropriate for Android. Also the
implementation for Android is quite optimized for running on mobile class
hardware, in a multi-process environment. (Just supporting the standard
core Java classes is often quite painful for us, because of how heavy-weight
they can be.)

Generally, using an existing API can have significant disadvantages as well
as advantages. Especially for something like AWT, where you are in a
position where you would need to compatibly support whatever existing APIs
you use, having to work under that existing API can actually make it a lot
more effort and less efficient to implement your desired system.

For example:

- We acquired the Skia graphics library for use in Android. Using AWT would
require significant work to expose that in the AWT API in a compatible way,
rather than directly exposing its actually rendering API as done in the
Android Canvas class.

- The AWT event model is fairly mouse-centric. It has concepts like moving
a pointer over the screen without a button being down, which we don't care
about, and lacks information like pressure and size (and its coordinates are
integers instead of floats). Likewise there is a slew of virtual key codes
we don't care about, and no standard definitions for ones we really care
about like search, home, back, call, hangup, etc.

- We have a lot of core concepts we want to have integrated into our view
hierarchy (contexts holding themes, layout inflation from xml, searching by
id, etc) that don't exist.

So what it boils down to, is we would be looking at implementing the generic
AWT, and them building our "desired" API on top of it. This would make
things a lot more complicated, introduce a lot more overhead (casting to our
extended view class continuously as we traverse through the view hierarchy
looking for an id!), and be of questionable benefit.

At then end of the day, the view hierarchy is at the very heart of the user
experience, and we had a specific experience we wanted to achieve. So it
makes a lot of sense for Andoid to define its own core UI model, designed
specifically to support its UI model, as the platform APIs.

And if you want AWT on Android... well you can implement the AWT APIs on
top of the Android UI. That's how AWT is supposed to work, right? ;)

On Sat, Apr 4, 2009 at 6:57 PM, Videoguy <> wrote:

Dianne Hackborn
Android framework engineer

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


Question about Android GUI system

by Videoguy » Sun, 05 Apr 2009 15:45:43 GMT

 Thanks Dianne!


Question about Android GUI system

by Nanard » Wed, 08 Apr 2009 15:13:11 GMT

 I suppose that can answer the question :

- AWT uses OS lib for drawing.  Android is mostly Java.  Of course
there should be some C lib for drawing on the screen somewhere...

- AWT, Swing and other are for desktop.  Mobile devices UI are a lot
differents : one app at a time uses the full screen, no resizing

- AWT is by default not nice.  I support Google wanted a nice Look and
Feel for all their devices.

- Event management on a PC and a small mobile device is different :
more interrupt (call, SMS, battery, no mouse...)

- AWT is only used for drawing.  Google needed to create a whole
Desktop (menus, virtual screens).  So they needed to write a lot of
code anyway.

But : I agree : it may be boring to rewrite the same app again and
again (C, .NET, Java/Swing, iPhone, Andorid, Symbian, etc).

Question about Android GUI system

by tom » Thu, 09 Apr 2009 15:36:52 GMT

 agree with you


Question about Android GUI system

by nowb » Mon, 13 Apr 2009 20:57:55 GMT

 I just started looking in to the framework so this might me the
stupidest question...

in frameworks/base/awt you can find the java.awt package, first I
thought this was some kind of internal api but after reading this I
guess it's not. So, what is it doing there? Can it be used?


Other Threads

1. Dev Phone Shipping time - Brightstarcorp taking forever

I ordered the Dev Phone last Saturday, and yes, the shipping costs are
a bit high, but then I'd think at least that I'd get it quickly.... it
also said something about it taking 3 business days and I thought
that's pretty cool...

but what it really meant was that Brighstarcorp is taking 3 days to
place their order at UPS... had they just placed the order on Monday
as you'd expect, I would have it by now... but somehow they waited
until Wednesday to place the order at UPS.... That's ridiculous

Google shouldn't use this company for managing their shipping anymore,
I don't know what the point is of having a fast UPS shipping if they
first wait and drink coffee for 3 days before they even start the

anyone had the same experience?


2. How does OpenCORE PVMF work ?

Dear all,

I am trying to understand the call flow of PV player and PV Author in
OpenCORE PV frame work. I am intrested in understanding the call flow from
application to till Openmax component.

My questions are

1. If i want to replace the existing software codecs with hardware codecs
(with or without OMX complaiance) wht will be the major changes in the
current code.

2.How can track down the code flow from application to Openmax to hardware
happens in PV Player and author is there any doc which explains about this ?
If no doc atleast share the ideas.

How does the commands flow ? Like when i say media player start from java
application wht will be the major steps that will happen in the process..

Like reading from the registry, creating the elements ... blah blah ..

Say i have done with creating the nodes if some command is pushed in the
command queue does it apply on all the nodes (parser, decoder,sink..) ?

What is thread_Logon and thread_Logoff ? For each module i see these
functions ? when will they get created.

I guess the commands are sent in asynchronous fashion so its difficult for
me to understand the code.

3.Which is the best place to start the if i want to replace software codecs
with hardware codecs ? Why OMX complaince is only for decoder ? No OMX
complaince for encoder, parser ... ?

Please share the info..



3. Please help with android source making

4. Scanning raw memory for malwar

5. SecurityException trying to load a Map in a tab via Intent

6. Bluetooth in Android How to enable bccmd

7. How Can I Remove Top Title Bar from an Application? Or Add things to it...