Thursday, January 10, 2013

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

No comments:

Post a Comment