Thanks a lot dor the input. >From all that was said, I believe that I may be feeding the View Constructor with something else than the activity, probably something like Application or similar, I know I copied one example from the SDK, if I'm not mistaken, I'll have to check when I get back home.
But having to force a cast on the context given to a view, just to be able to call the methods from the activity on the same context, seems like a hack to me. Probably better than what I'm doing know (forcing the flag NEW_TASK_LAUNCH). But this probably hints that something must be changed in the interface between an Activity and a View. Since, the need to force casts to input of an API, is usually sign of a not so good solution. Food for tought, probably. Is this Activity - View communication model, by any chance already being review for future versions? If Yes, any info on it, that could be advanced before hand ? Thanks a LOT for the prompt feedback. On Apr 8, 9:04 am, "Dan U." <[EMAIL PROTECTED]> wrote: > True. To make it more generic, some class checking should be done. > > On Apr 8, 12:28 am, hackbod <[EMAIL PROTECTED]> wrote: > > > On Apr 7, 11:52 pm, "Dan U." <[EMAIL PROTECTED]> wrote: > > > > > Inside aview, apparently we can't get a reference to theActivity > > > > that contains us (theview), and even if there is a way to get the > > > > reference, we can't probably call it directly, due to UI threading > > > > issues. > > > You do have access to theActivity. It's actually the Context that > > > gets passed into theviewconstructor. You'll just have to cast it to > > >Activity. > > > Though formally you shouldn't assume the Context you have in aviewis > > anActivity(for example the Dialog class creates a wrapper of the > > context you give it that is set up to have the correct theme for a > > dialog)... for a particular application, if you know that the Context > > you used to create aviewis actually anActivity(because after all > > that is the thing you passed to theviewconstructor or inflate > > function), then doing this should be fine. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

