I’ve always loved Groovy builders concept for handling (mostly creating) hierarchical documents. On the other hand I find StAX, pull-based processing API, to be one of my favorite methods for dealing with simple XML processing. It’s simple and fast, so what more can I ask for? Additionally, thanks to the Jettison project you can also use the StAX API to handle JSON documents. So, basically we can use one simple (standard) API to handle both XML and JSON documents in the same manner. The next logical step is to merge these two great pieces of technology into one.
I want to talk a little about Android. I am very much going to sidestep the holy war about is it or isn’t it Java, except to say, this looks a lot like something that would have been derived from the Danger stack. The commonalities are striking. As a Sidekick owner, I am terribly pleased with “Java-ish” development for that platform, and I think seeing something similar in wide deployment is great. That said…
First, lets talk about the Android UI API. I recall last year at Sun Tech Days,”The Gos” was asked what, in retrospect he would do different with Java. The first thing he came up with was the Swing API. The “747 Cockpit” feel of the API is overwhelming to new users. Frankly, Android takes this to a whole new level. Just look at the JavaDoc for the Checkbox class:
FOCUS_BACKWARD,
FOCUS_DOWN,
FOCUS_FORWARD,
FOCUS_LEFT,
FOCUS_RIGHT,
FOCUS_UP,
GONE,
INVISIBLE,
NORMAL_FOCUS,
NO_ID,
VIEW_LOG_TAG,
VISIBLE,
WEAK_FOCUS
mBottom,
mContext,
mLayoutParams,
mLeft,
mOnClickListener,
mOnFocusChangeListener,
mPaddingBottom,
mPaddingLeft,
mPaddingRight,
mPaddingTop,
mParent,
mRight,
mScrollX,
mScrollY,
mTag,
mTop,
mWindowLeft,
mWindowTop
protected
|
|
|
int
|
mBottom
|
The distance in pixels from the bottom edge of this view’s parent to the bottom edge of this view.
|
protected
|
|
|
Context
|
mContext
|
The application environment this view lives in.
|
protected
|
|
|
LayoutParams
|
mLayoutParams
|
The layout parameters associated with this view and used by the parent ViewGroup to determine how this view should be laid out.
|
protected
|
|
|
int
|
mLeft
|
The distance in pixels from the left edge of this view’s parent to the left edge of this view.
|
protected
|
|
|
OnClickListener
|
mOnClickListener
|
Listener used to dispatch click events.
|
protected
|
|
|
OnFocusChangeListener
|
mOnFocusChangeListener
|
Listener used to dispatch focus change events.
|
protected
|
|
|
int
|
mPaddingBottom
|
The bottom padding in pixels, that is the distance in pixels between the bottom edge of this view and the bottom edge of its content.
|
protected
|
|
|
int
|
mPaddingLeft
|
The left padding in pixels, that is the distance in pixels between the left edge of this view and the left edge of its content.
|
protected
|
|
|
int
|
mPaddingRight
|
The right padding in pixels, that is the distance in pixels between the right edge of this view and the right edge of its content.
|
protected
|
|
|
int
|
mPaddingTop
|
The top padding in pixels, that is the distance in pixels between the top edge of this view and the top edge of its content.
|
protected
|
|
|
ViewParent
|
mParent
|
The parent this view is attached to.
|
protected
|
|
|
int
|
mRight
|
The distance in pixels from the right edge of this view’s parent to the right edge of this view.
|
protected
|
|
|
int
|
mScrollX
|
The offset, in pixels, by which the content of this view is scrolled horizontally.
|
protected
|
|
|
int
|
mScrollY
|
The offset, in pixels, by which the content of this view is scrolled vertically.
|
protected
|
|
|
Object
|
mTag
|
The view’s tag.
|
protected
|
|
|
int
|
mTop
|
The distance in pixels from the top edge of this view’s parent to the top edge of this view.
|
protected
|
|
|
int
|
mWindowLeft
|
The distance in pixels from the left edge of this view’s enclosing window to the left edge of this view.
|
protected
|
|
|
int
|
mWindowTop
|
The distance in pixels from the top edge of this view’s enclosing window to the top edge of this view.
|
Public Constructors
addTextChangedListener,
append,
append,
computeHorizontalScrollRange,
computeScroll,
computeVerticalScrollRange,
debug,
getBaseline,
getDisabledTextColor,
getFilters,
getFocusedTextColor,
getHintTextColor,
getInputMethod,
getInterestingRect,
getLayout,
getLineBounds,
getLineCount,
getLineHeight,
getMovementMethod,
getNormalTextColor,
getPaint,
getPaintFlags,
getSelectedTextColor,
getText,
getTextScaleX,
getTextSize,
getTransformationMethod,
getTypeface,
length,
onDraw,
onFocusChanged,
onKeyDown,
onKeyUp,
onMeasure,
onTextChanged,
restoreState,
saveState,
saveStateAndText,
setAlignment,
setCursorVisible,
setDisabledTextColor,
setEms,
setFilters,
setFocusedTextColor,
setGravity,
setHeight,
setHiliteColor,
setHint,
setHint,
setHintTextColor,
setHorizontallyScrolling,
setIncludeFontPadding,
setInputMethod,
setLineSpacing,
setLines,
setMaxEms,
setMaxHeight,
setMaxLines,
setMaxWidth,
setMinEms,
setMinHeight,
setMinLines,
setMinWidth,
setMovementMethod,
setNormalTextColor,
setPadding,
setPaintFlags,
setScroller,
setSelectAllOnFocus,
setSelectedTextColor,
setShadowLayer,
setSingleLine,
setSingleLine,
setText,
setText,
setText,
setText,
setText,
setText,
setTextColor,
setTextScaleX,
setTextSize,
setTextSize,
setTransformationMethod,
setTypeface,
setWidth,
windowFocusChanged
|
|
|
|
void
|
addTextChangedListener(TextWatcher watcher)
|
|
|
final
|
|
void
|
append(CharSequence text)
|
|
|
|
|
void
|
append(CharSequence text, int start, int end)
|
|
|
|
|
int
|
computeHorizontalScrollRange()
|
|
|
|
|
void
|
computeScroll()
|
|
|
|
|
int
|
computeVerticalScrollRange()
|
|
|
|
|
void
|
debug(int depth)
|
|
|
|
|
int
|
getBaseline()
|
|
|
|
|
int
|
getDisabledTextColor()
|
|
|
|
|
InputFilter[]
|
getFilters()
|
|
|
|
|
int
|
getFocusedTextColor()
|
|
|
final
|
|
int
|
getHintTextColor()
|
|
|
final
|
|
InputMethod
|
getInputMethod()
|
|
|
|
|
void
|
getInterestingRect(Rect r)
|
|
|
final
|
|
Layout
|
getLayout()
|
|
|
|
|
int
|
getLineBounds(int line, Rect bounds)
|
|
|
|
|
int
|
getLineCount()
|
|
|
|
|
int
|
getLineHeight()
|
|
|
final
|
|
MovementMethod
|
getMovementMethod()
|
|
|
|
|
int
|
getNormalTextColor()
|
|
|
|
|
Paint
|
getPaint()
|
|
|
|
|
int
|
getPaintFlags()
|
|
|
|
|
int
|
getSelectedTextColor()
|
|
|
|
|
CharSequence
|
getText()
|
|
|
|
|
float
|
getTextScaleX()
|
|
|
|
|
float
|
getTextSize()
|
|
|
final
|
|
TransformationMethod
|
getTransformationMethod()
|
|
|
|
|
Typeface
|
getTypeface()
|
|
|
|
|
int
|
length()
|
|
|
|
|
void
|
onDraw(Canvas canvas)
|
|
|
|
|
void
|
onFocusChanged(boolean focused, int direction)
|
|
|
|
|
boolean
|
onKeyDown(int keyCode, KeyEvent event)
|
|
|
|
|
boolean
|
onKeyUp(int keyCode, KeyEvent event)
|
|
|
|
|
void
|
onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
|
|
|
|
void
|
onTextChanged(CharSequence text, int start, int before, int after)
|
|
|
|
|
boolean
|
restoreState(Bundle state)
|
|
|
|
|
Bundle
|
saveState()
|
|
|
|
|
Bundle
|
saveStateAndText()
|
|
|
|
|
void
|
setAlignment(Alignment align)
|
|
|
|
|
void
|
setCursorVisible(boolean visible)
|
|
|
|
|
void
|
setDisabledTextColor(int color)
|
|
|
|
|
void
|
setEms(int ems)
|
|
|
|
|
void
|
setFilters(InputFilter[] filters)
|
|
|
|
|
void
|
setFocusedTextColor(int color)
|
|
|
|
|
void
|
setGravity(int gravity)
|
|
|
|
|
void
|
setHeight(int pixels)
|
|
|
|
|
void
|
setHiliteColor(int color)
|
|
|
final
|
|
void
|
setHint(CharSequence hint)
|
|
|
final
|
|
void
|
setHint(int resid)
|
|
|
final
|
|
void
|
setHintTextColor(int color)
|
|
|
|
|
void
|
setHorizontallyScrolling(boolean whether)
|
|
|
|
|
void
|
setIncludeFontPadding(boolean includepad)
|
|
|
|
|
void
|
setInputMethod(InputMethod input)
|
|
|
|
|
void
|
setLineSpacing(float add, float mult)
|
|
|
|
|
void
|
setLines(int lines)
|
|
|
|
|
void
|
setMaxEms(int maxems)
|
|
|
|
|
void
|
setMaxHeight(int maxHeight)
|
|
|
|
|
void
|
setMaxLines(int maxlines)
|
|
|
|
|
void
|
setMaxWidth(int maxpixels)
|
|
|
|
|
void
|
setMinEms(int minems)
|
|
|
|
|
void
|
setMinHeight(int minHeight)
|
|
|
|
|
void
|
setMinLines(int minlines)
|
|
|
|
|
void
|
setMinWidth(int minpixels)
|
|
|
final
|
|
void
|
setMovementMethod(MovementMethod movement)
|
|
|
|
|
void
|
setNormalTextColor(int color)
|
|
|
|
|
void
|
setPadding(int left, int top, int right, int bottom)
|
|
|
|
|
void
|
setPaintFlags(int flags)
|
|
|
|
|
void
|
setScroller(Scroller s)
|
|
|
|
|
void
|
setSelectAllOnFocus(boolean selectAllOnFocus)
|
|
|
|
|
void
|
setSelectedTextColor(int color)
|
|
|
|
|
void
|
setShadowLayer(float radius, float dx, float dy, int color)
|
|
|
|
|
void
|
setSingleLine()
|
|
|
|
|
void
|
setSingleLine(boolean singleLine)
|
|
|
final
|
|
void
|
setText(int resid)
|
|
|
final
|
|
void
|
setText(int resid, BufferType type)
|
|
|
final
|
|
void
|
setText(Cursor cursor, int column, BufferType type)
|
|
|
final
|
|
void
|
setText(CharSequence text)
|
|
|
|
|
void
|
setText(CharSequence text, BufferType type)
|
|
|
final
|
|
void
|
setText(Cursor cursor, int column)
|
|
|
|
|
void
|
setTextColor(int color)
|
|
|
|
|
void
|
setTextScaleX(float size)
|
|
|
|
|
void
|
setTextSize(int unit, float size)
|
|
|
|
|
void
|
setTextSize(float size)
|
|
|
final
|
|
void
|
setTransformationMethod(TransformationMethod method)
|
|
|
|
|
void
|
setTypeface(Typeface tf)
|
|
|
|
|
void
|
setWidth(int pixels)
|
|
|
|
|
void
|
windowFocusChanged(boolean hasWindowFocus)
|
awakenScrollBars,
awakenScrollBars,
bringToFront,
clearAnimation,
clearFocus,
computeHorizontalScrollExtent,
computeHorizontalScrollOffset,
computeHorizontalScrollRange,
computeScroll,
computeVerticalScrollExtent,
computeVerticalScrollOffset,
computeVerticalScrollRange,
copyWindowBitmap,
createDrawableState,
debug,
debug,
debugIndent,
dispatchDraw,
dispatchKeyEvent,
dispatchMotionEvent,
dispatchUnhandledMove,
dispatchWindowFocusChanged,
draw,
drawableStateChanged,
findFocus,
findParentViewOfType,
findViewById,
findViewWithTag,
focusSearch,
focusSearchInDescendants,
forceLayout,
getAbsoluteLocationOnScreen,
getBackground,
getBaseline,
getBlockDescendantFocus,
getBlockUnmatchedKeyUps,
getBottom,
getContext,
getCurrentAnimation,
getDefaultSize,
getDrawableState,
getDrawingRect,
getDrawingTime,
getFocusType,
getFocusables,
getGlobalVisibleRect,
getGlobalVisibleRect,
getHeight,
getHitRect,
getHorizontalFadingEdgeLength,
getId,
getInterestingRect,
getLayoutParams,
getLeft,
getLocalVisibleRect,
getLocationOnScreen,
getMeasuredHeight,
getMeasuredWidth,
getOnFocusChangeListener,
getPaddingBottom,
getPaddingLeft,
getPaddingRight,
getPaddingTop,
getParent,
getResources,
getRight,
getRootView,
getScrollX,
getScrollY,
getTag,
getTop,
getVerticalFadingEdgeLength,
getVisibility,
getWidth,
getWindowBottom,
getWindowFrame,
getWindowLeft,
getWindowRight,
getWindowSession,
getWindowToken,
getWindowTop,
hasBackground,
hasFocus,
hasWindowFocus,
initializeFadingEdge,
initializeScrollbars,
invalidate,
invalidate,
invalidate,
invalidateDrawable,
isEnabled,
isFocusable,
isFocused,
isHorizontalFadingEdgeEnabled,
isHorizontalScrollBarEnabled,
isLayoutRequested,
isSelected,
isVerticalFadingEdgeEnabled,
isVerticalScrollBarEnabled,
layout,
measure,
offsetLeftAndRight,
offsetTopAndBottom,
onAttachedToWindow,
onDetachedFromWindow,
onDraw,
onDrawAfterChildren,
onDrawBackground,
onFinishInflate,
onFocusChanged,
onKeyDown,
onKeyUp,
onLayout,
onMeasure,
onMotionEvent,
onScrollChanged,
onSizeChanged,
performClick,
postInvalidate,
postInvalidateDelayed,
refreshDrawableState,
requestFocus,
requestFocus,
requestLayout,
requestRectangleOnScreen,
resolveSize,
scheduleDrawable,
scrollBy,
scrollTo,
setBackground,
setBackground,
setBackgroundColor,
setBlockDescendantFocus,
setBlockUnmatchedKeyUps,
setCurrentAnimation,
setEnabled,
setFocusType,
setFocusable,
setHorizontalFadingEdgeEnabled,
setHorizontalScrollBarEnabled,
setId,
setKeyListener,
setLayoutParams,
setMeasuredDimension,
setOnClickListener,
setOnFocusChangeListener,
setPadding,
setPreferredHeight,
setPreferredWidth,
setSelected,
setTag,
setVerticalFadingEdgeEnabled,
setVerticalScrollBarEnabled,
setVisibility,
setWillNotDraw,
startAnimation,
takeFocus,
unscheduleDrawable,
unscheduleDrawable,
verifyDrawable,
willNotDraw,
windowFocusChanged