android-developers
[Arriba] [Todas las Listas]

Re: [android-developers] Ayuda con FindViewById

To: android-developers@xxxxxxxxxxxxxxxx
Subject: Re: [android-developers] Ayuda con FindViewById
From: Mark Murphy <mmurphy@xxxxxxxxxxxxxxx>
Date: Mon, 31 Oct 2011 13:47:43 -0400
Delivery-date: Mon, 31 Oct 2011 13:48:31 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:in-reply-to:references:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=TRFvutvtE0jRATcvT1uScsowBu/IVBxuqi7TGi1hbyc=; b=m/7A8VmNf3JZLGVxj8EghmkLZ7Rz4WsvzCJ9fa9aq2BN+sIvftWN3r7FTfUdqeiDM9 UYUe8gvejdVySnsq1VMxcDATmCRC4Z2XKaoh7J8+FBkdpD9C+4Vn9/6HgfXEA56daqMX OaSrQ+t7IaEyyT64LjPD8D9EBLgvWoTDHVV7c=
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <CAEqej2Mfr8EstrDiCsedv-o_mne0wN-u5BoJjYyfwBLu4MLJqA@mail.gmail.com>
List-archive: <http://groups.google.com/group/android-developers?hl=en_US>
List-help: <http://groups.google.com/support/?hl=en_US>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <http://groups.google.com/group/android-developers/post?hl=en_US>, <mailto:android-developers@googlegroups.com>
List-subscribe: <http://groups.google.com/group/android-developers/subscribe?hl=en_US>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <http://groups.google.com/group/android-developers/subscribe?hl=en_US>, <mailto:android-developers+unsubscribe@googlegroups.com>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
References: <CAEqej2N1uasnSMv061YHh+vCu6C8uM7ANxiXq-chq6pTv6V_iA@mail.gmail.com> <CALLdnhOAs9US_NPPM4LH2-v9U-c17AuomTbrYd8m5jj-f_BtEA@mail.gmail.com> <CAEqej2PWvV4D2aeWnxonxjrydKHGwBiYDWOEMQkD0OXjq-pc6g@mail.gmail.com> <CALLdnhOf=N1S-2zQtA_EESgzAW3iyLymsHJTAUizBXx203cwyw@mail.gmail.com> <CAEqej2M8Z6yQwcvu5md3qgrhy-YDW5x4bV1OY_Na4dxmqeS9EA@mail.gmail.com> <CAEqej2Mfr8EstrDiCsedv-o_mne0wN-u5BoJjYyfwBLu4MLJqA@mail.gmail.com>
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx
En *Mon, *Oct 31, 2011 en 1:35 PM, Mark *Phillips
<mark@xxxxxxxxxxxxxxxxxxxxx> escribió:
> pienso que lo encontré......Con vuestra sugerencia para mirar en la actividad...
>
> ((Actividad1)*getContext()).<Algunos método público en la Actividad);
>
> Es esto la manera mejor de cumplir lo que quiero?

*Tactically, allí parecer para ser algún *scenarios en qué *getContext() de una
Vista no regresa una Actividad, sino algo más
(*ContextWrapper, *IIRC).

Estratégicamente, puede ser más limpio para ti para definir una interfaz, haber
*MyHorizontalScrollView aguantar un caso de aquella interfaz, tiene vuestro
suministro de actividad *MyHorizontalScrollView con una implementación de aquella
interfaz, y tener *MyHorizontalScrollView métodos de llamada en aquella
implementación de interfaz cuando necesitado. En particular, haría la interfaz
ser "*evented" -- *MyHorizontalScrollView tampoco tendría que saber
ni preocuparse lo que otro *widgets es flotante alrededor, así que tendría que ser
emerger acontecimientos y dejando la actividad les maneja, bastante que
teniendo los objetos de suministro de la interfaz a *MyHorizontalScrollView y teniéndolo
masaje otro *widgets.

-- 
Mark *Murphy (un *Commons Guy)
*http://*commonsware.*com | *http://*github.*com/*commonsguy
*http://*commonsware.*com/*blog | *http://*twitter.*com/*commonsguy

_*Android Programación *Tutorials_ Versión 4.0 Disponible!

-- 
Recibiste este mensaje porque eres *subscribed al *Google
Grupos "*Android *Developers" grupo.
A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx

Puesto que más opciones, visita este grupo en
*http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en

On Mon, Oct 31, 2011 at 1:35 PM, Mark Phillips
<mark@xxxxxxxxxxxxxxxxxxxxx> wrote:
> I think I found it......with your suggestion to look at the activity...
>
> ((Activity1)getContext()).<some public method in the Activity);
>
> Is this the best way to accomplish what I want?

Tactically, there seem to be some scenarios in which getContext() of a
View does not return an Activity, but rather something else
(ContextWrapper, IIRC).

Strategically, it may be cleaner for you to define an interface, have
MyHorizontalScrollView hold an instance of that interface, have your
activity supply MyHorizontalScrollView with an implementation of that
interface, and have MyHorizontalScrollView call methods on that
interface implementation as needed. In particular, I would make the
interface be "evented" -- MyHorizontalScrollView should neither know
nor care what other widgets are floating around, so it should be
surfacing events and letting the activity handle them, rather than
having the interface supply objects to MyHorizontalScrollView and
having it massage other widgets.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 4.0 Available!

-- 
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

<Anterior por Tema] Tema Actual [Siguiente por Tema>