On Apr 8, 7:22 am, Rui Martins <[EMAIL PROTECTED]> wrote: > 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).
Well, you have a range of choices: - Using NEW_TASK_LAUNCH like this is fundamentally broken (unless that is the semantics you really want)/ - Performing a cast is a quick and dirty style that you can use when you know exactly how your View class will be used. - You can give an explicitly Activity object to the view, which allows the view to work in all situations though it may be awkward to hook things up. - Or you can have a formal callback interface from the view, like the various ones used in the platform frameworks, which is the cleanest approach. > 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. No, this is intentional. A view may very well not be running inside of an activity. For example, it could be put in a dialog, in which case there is no activity to finish. > 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 ? We don't expect any major changes to it. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

