Thursday, January 10, 2013

[android-developers] How to call startactivityforresult from a non-activity class to get the resuts

is it possible to call startactivityforresult from a non-activity class to get the results. 
 
Scenario is something like this

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 Also Since I don't want to derive from activity class that means I cannot override OnActivityResult() where results actually come

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. This API executes series of steps and some of them involves taking data from user in form of activity. Even if we forget about startActivityForResult all I want is data from a activity in the non activity class is this scenario not a valid one in android?

thanks Monty

--
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