[android-developers] Re: Starting an Activity from a callback class

2010-08-19 Thread Indicator Veritatis
Treking is right: you are simply not posting enough information. And
what you have posted is problematic and misleading: what do you MEAN
the application 'closes'? Have you really missed all the heated
discussions explaining why developers should not close/exit their own
application components, but leave that to the system to do?

On Aug 18, 12:58 pm, Priyank priyankvma...@gmail.com wrote:
 Hi,
 I have an activity class(Application Class ) which calls a service
 class(Service Class) and closes.
 The service class takes about 5 seconds to complete its task and calls
 a method which is present in another class(Callback Class). Now
 according to the result, the callback needs to notify the Application
 class.

 Once i get the callback from the service, I tried calling a method
 defined in the Application class. In this method i create a new intent
 of Application class and call startActivity(Application Class).
 But this is not working. Can anyone tell where i am going wrong and
 what can I do to solve this issue.

 Thanks,
 Priyank

-- 
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] Re: Starting an Activity from a callback class

2010-08-19 Thread Priyank Maiya
I was able to fix the problem.
The issue was that i did not have the context instance in my callback class.

I created a constructor where I got the context from the service class.

Using that I was able to call the application activity class.
Also I had to use
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); for starting the task..

This was my constructor in the callback class
private VServiceCallBack(Context iContext)
{
context = iContext;
}

And according to the arguments received,

{
Intent appView = new Intent(context, AppView.class);
appView .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(appView );
}

Sorry for the confusion, and thanks for the help..

Priyank



On Thu, Aug 19, 2010 at 5:34 PM, Indicator Veritatis mej1...@yahoo.comwrote:

 Treking is right: you are simply not posting enough information. And
 what you have posted is problematic and misleading: what do you MEAN
 the application 'closes'? Have you really missed all the heated
 discussions explaining why developers should not close/exit their own
 application components, but leave that to the system to do?

 On Aug 18, 12:58 pm, Priyank priyankvma...@gmail.com wrote:
  Hi,
  I have an activity class(Application Class ) which calls a service
  class(Service Class) and closes.
  The service class takes about 5 seconds to complete its task and calls
  a method which is present in another class(Callback Class). Now
  according to the result, the callback needs to notify the Application
  class.
 
  Once i get the callback from the service, I tried calling a method
  defined in the Application class. In this method i create a new intent
  of Application class and call startActivity(Application Class).
  But this is not working. Can anyone tell where i am going wrong and
  what can I do to solve this issue.
 
  Thanks,
  Priyank

 --
 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.comandroid-developers%2bunsubscr...@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