It works, thanks, I'm a c++ developer before, I'm studying java at the same time :)
On Jun 20, 11:29 pm, "Mark Murphy" <[email protected]> wrote: > > Sorry, still dont know how to get that object in activity. do you have > > an example? Thanks. > > I recommend that developers learn Java outside of Android before > attempting to tackle Android development. > > >> > I defined an object in activity, and defined two views in this > >> > activity, can I access this object in the views? > > A View can call getContext() on itself. That will return the View's > Activity. Cast it to the specific Activity class (e.g., YourOwnActivity). > Then call methods on that activity. On the activity, make the object > accessible via a method. Now your Views can access relevant objects inside > YourOwnActivity. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

