diff --git a/api/current.xml b/api/current.xml index fcd97ceeb4b2b..495eb811f7743 100644 --- a/api/current.xml +++ b/api/current.xml @@ -5366,6 +5366,17 @@ visibility="public" > + + @@ -1874,6 +1876,36 @@ public class View implements Drawable.Callback, KeyEvent.Callback { case R.styleable.View_minHeight: mMinHeight = a.getDimensionPixelSize(attr, 0); break; + case R.styleable.View_onClick: + final String handlerName = a.getString(attr); + if (handlerName != null) { + setOnClickListener(new OnClickListener() { + private Method mHandler; + + public void onClick(View v) { + if (mHandler == null) { + try { + mHandler = getContext().getClass().getMethod(handlerName, + View.class); + } catch (NoSuchMethodException e) { + throw new IllegalStateException("Could not find a method " + + handlerName + "(View) in the activity", e); + } + } + + try { + mHandler.invoke(getContext(), View.this); + } catch (IllegalAccessException e) { + throw new IllegalStateException("Could not execute non " + + "public method of the activity", e); + } catch (InvocationTargetException e) { + throw new IllegalStateException("Could not execute " + + "method of the activity", e); + } + } + }); + } + break; } } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index a4941452ec6ab..5b3fbbda1b452 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1165,6 +1165,13 @@ enabled for events such as long presses. --> + +