Re: [android-developers] How to call startactivityforresult from a non-activity class to get the resuts
On Thu, Jan 10, 2013 at 3:15 PM, Monty Jain montyj...@gmail.com wrote: is it possible to call startactivityforresult from a non-activity class to get the results. No, sorry. I have a class Class NonActivity(it doesn't derive from Activity as its not a UI). This class will have bunch of functions(steps basically) to run. One of the step requires to show UI(Activity) and then get the result(user enter something). Then been able to use that data in next following steps. how can this be achieved without deriving from activity class as I don't have UI component Collect the data before the first step, from your activity. Basically reason for using Non-Activity class is that I want to encapsulate the whole process into a class(API) then anyone who wants to use this class can call its API. IMHO, such a library absolutely, positively should NOT be starting an activity. The developer using the library needs to have control over that behavior. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Aqui estão alguns sites onde você pode perguntar ou responder dúvidas sobre desenvolvimento de aplicações para Android: http://www.andglobe.com -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to call startactivityforresult from a non-activity class to get the resuts
hey Thanks Mark for your reply IMHO, such a library absolutely, positively should NOT be starting an activity. The developer using the library needs to have control over that behavior. Wanted to check if I have understood it correctly or not. Basically I want to develop a library which perform certain task which involves running certain series of steps. one of the steps can be involve starting an activity(UI to get input) and use that data to finish that step. So is this bad design that a library starting an activity.. from android perspective From scenario perspective we should be able to do that right? On Thursday, January 10, 2013 12:36:53 PM UTC-8, Mark Murphy (a Commons Guy) wrote: On Thu, Jan 10, 2013 at 3:15 PM, Monty Jain mont...@gmail.comjavascript: wrote: is it possible to call startactivityforresult from a non-activity class to get the results. No, sorry. I have a class Class NonActivity(it doesn't derive from Activity as its not a UI). This class will have bunch of functions(steps basically) to run. One of the step requires to show UI(Activity) and then get the result(user enter something). Then been able to use that data in next following steps. how can this be achieved without deriving from activity class as I don't have UI component Collect the data before the first step, from your activity. Basically reason for using Non-Activity class is that I want to encapsulate the whole process into a class(API) then anyone who wants to use this class can call its API. IMHO, such a library absolutely, positively should NOT be starting an activity. The developer using the library needs to have control over that behavior. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Aqui estão alguns sites onde você pode perguntar ou responder dúvidas sobre desenvolvimento de aplicações para Android: http://www.andglobe.com -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to call startactivityforresult from a non-activity class to get the resuts
On Thu, Jan 10, 2013 at 4:12 PM, Monty Jain montyj...@gmail.com wrote: Basically I want to develop a library which perform certain task which involves running certain series of steps. one of the steps can be involve starting an activity(UI to get input) and use that data to finish that step. So is this bad design that a library starting an activity.. from android perspective From scenario perspective we should be able to do that right? No, unless the library is defining an activity which the app using the library perhaps is subclassing, and then only if the library's activity is the one executing these steps and collecting data from the user via startActivityForResult(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Aqui estão alguns sites onde você pode perguntar ou responder dúvidas sobre desenvolvimento de aplicações para Android: http://www.andglobe.com -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to call startactivityforresult from a non-activity class to get the resuts
Couldn't someone using this library call it from within an Activity, passing this to that code and using this create the activity at that point when it's needed? On Thu, Jan 10, 2013 at 1:19 PM, Mark Murphy mmur...@commonsware.comwrote: On Thu, Jan 10, 2013 at 4:12 PM, Monty Jain montyj...@gmail.com wrote: Basically I want to develop a library which perform certain task which involves running certain series of steps. one of the steps can be involve starting an activity(UI to get input) and use that data to finish that step. So is this bad design that a library starting an activity.. from android perspective From scenario perspective we should be able to do that right? No, unless the library is defining an activity which the app using the library perhaps is subclassing, and then only if the library's activity is the one executing these steps and collecting data from the user via startActivityForResult(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Aqui estão alguns sites onde você pode perguntar ou responder dúvidas sobre desenvolvimento de aplicações para Android: http://www.andglobe.com -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to call startactivityforresult from a non-activity class to get the resuts
On Thu, Jan 10, 2013 at 5:09 PM, Kevin Duffey andjar...@gmail.com wrote: Couldn't someone using this library call it from within an Activity, passing this to that code and using this create the activity at that point when it's needed? Yes, but that does not handle the onActivityResult() portion. You can create wrappers that attempt to simplify this somewhat (e.g., Barcode Scanner and its IntentIntegrator), but the hosting app still needs an activity that has onActivityResult() that, at best, can forward the result to the library for further processing. If the OP's library is a simple wrapper around some activity, akin to Barcode Scanner and IntentIntegrator, then I'm less worried. The OP's library seems to be more involved than that, in which case the developer using the library may need greater control over this launched activity. Even with Barcode Scanner, we see developers wanting different behavior (e.g,. no dependencies on the Barcode Scanner app, ability to add information to the scanning activity UI). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Aqui estão alguns sites onde você pode perguntar ou responder dúvidas sobre desenvolvimento de aplicações para Android: http://www.andglobe.com -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to call startactivityforresult from a non-activity class to get the resuts
Perhaps you could create an interface for your Activity-clients to implement. You then pass to your library class a reference to this (now a YourLibraryInterface). Marina On Jan 10, 2013 7:10 p.m., Kevin Duffey andjar...@gmail.com wrote: Couldn't someone using this library call it from within an Activity, passing this to that code and using this create the activity at that point when it's needed? On Thu, Jan 10, 2013 at 1:19 PM, Mark Murphy mmur...@commonsware.comwrote: On Thu, Jan 10, 2013 at 4:12 PM, Monty Jain montyj...@gmail.com wrote: Basically I want to develop a library which perform certain task which involves running certain series of steps. one of the steps can be involve starting an activity(UI to get input) and use that data to finish that step. So is this bad design that a library starting an activity.. from android perspective From scenario perspective we should be able to do that right? No, unless the library is defining an activity which the app using the library perhaps is subclassing, and then only if the library's activity is the one executing these steps and collecting data from the user via startActivityForResult(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Aqui estão alguns sites onde você pode perguntar ou responder dúvidas sobre desenvolvimento de aplicações para Android: http://www.andglobe.com -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en