[android-developers] Re: ReStarting An Activity From A Service

2009-04-18 Thread Marco Nelissen
On Sat, Apr 18, 2009 at 8:50 AM, Mohamed Amir wrote: > > I have a Service that starts an Activity on certain event passing to > it some parameters. > > The problem is if the Activity is still open, when the service tries > to startActivity() again, the activity isn't started because it's > alread

[android-developers] Re: ReStarting An Activity From A Service

2009-04-18 Thread Mark Murphy
> I have a Service that starts an Activity on certain event passing to > it some parameters. I do not recommend this. What if the user is in the middle of doing something else? > The problem is if the Activity is still open, when the service tries > to startActivity() again, the activity isn't s

[android-developers] Re: ReStarting An Activity From A Service

2009-04-19 Thread Mohamed Amir
Thank you for your answers. Marco: I will check your solution. Mark: The user isn't supposed to be doing anything. Just reading some information, and it's required to see the most updated information sent by the service. On Apr 18, 5:56 pm, "Mark Murphy" wrote: > > I have a Service that sta

[android-developers] Re: ReStarting An Activity From A Service

2009-04-19 Thread Mark Murphy
Mohamed Amir wrote: > Mark: The user isn't supposed to be doing anything. Just reading some > information, and it's required to see the most updated information > sent by the service. What if they are in the middle of writing a text message, or are using some other application? Why do you think

[android-developers] Re: ReStarting An Activity From A Service

2009-04-20 Thread Mohamed Amir
OK Mark. I am trying to make an application that show the caller-ID when there is an incoming call. And where there is another call, I wanna update the caller-ID shown. I have tried OnNewIntent but this callback wasn't called. The service code is something like that @Override p

[android-developers] Re: ReStarting An Activity From A Service

2009-04-20 Thread Jonas Petersson
Hi Mohamed, Mohamed Amir wrote: > I am trying to make an application that show the caller-ID when there > is an incoming call. > And where there is another call, I wanna update the caller-ID shown. Sounds familiar - I do similar stuff in "Zap's Hitta" (see Market). > I have tried OnNewIntent bu

[android-developers] Re: ReStarting An Activity From A Service

2009-04-20 Thread Mohamed Amir
Hi Jonas, Thank you for your reply. The activity is created properly when an incoming call takes place. The problem is when another call takes place and the first activity is still shown. I think it's not a permission problem. On Apr 20, 9:30 pm, "Jonas Petersson" wrote: > Hi Mohamed, > > Moh

[android-developers] Re: ReStarting An Activity From A Service

2009-04-20 Thread Marco Nelissen
On Mon, Apr 20, 2009 at 12:15 PM, Mohamed Amir wrote: > > OK Mark. > > I am trying to make an application that show the caller-ID when there > is an incoming call. > And where there is another call, I wanna update the caller-ID shown. > > I have tried OnNewIntent but this callback wasn't called.

[android-developers] Re: ReStarting An Activity From A Service

2009-04-20 Thread Mohamed Amir
:-) Well, it's just a typo here but it is correct in the code I have tried. Thank you after all. On Apr 20, 10:14 pm, Marco Nelissen wrote: > On Mon, Apr 20, 2009 at 12:15 PM, Mohamed Amir wrote: > > > > > OK Mark. > > > I am trying to make an application that show the caller-ID when there > >

[android-developers] Re: ReStarting An Activity From A Service

2009-04-20 Thread Dianne Hackborn
Did you try setting android:launchMode="singleTop" in your manifest? On Mon, Apr 20, 2009 at 3:11 PM, Mohamed Amir wrote: > > :-) > Well, it's just a typo here but it is correct in the code I have > tried. > > Thank you after all. > > > On Apr 20, 10:14 pm, Marco Nelissen wrote: > > On Mon, Apr

[android-developers] Re: ReStarting An Activity From A Service

2009-04-21 Thread Mohamed Amir
Yes, I have set the activity android:launchMode="singleTop" in the manifest, but still in vain. I have put breakpoints in onCreate() and onNewIntent(). onCreate is called only the first time, and onNewIntent is never called. On Apr 21, 12:37 am, Dianne Hackborn wrote: > Did you try setting an

[android-developers] Re: ReStarting An Activity From A Service

2009-04-21 Thread Mohamed Amir
Hi Dianne, I have found this in the doc. when the activity is re-launched while at the top of the activity stack instead of a new instance of the activity being started, onNewIntent() will be called on the existing instance with the Intent that was used to re-launch it. on my case, the incomin

[android-developers] Re: ReStarting An Activity From A Service

2009-04-21 Thread Mohamed Amir
OK, sorry, Dianne. It works now. I just did as you said, I am not sure why it wasn't working in the first place. Thank you Dianne. On Apr 21, 2:50 pm, Mohamed Amir wrote: > Hi Dianne, > > I have found this in the doc. > >  when the activity is re-launched while at the top of the activity > st

[android-developers] Re: ReStarting An Activity From A Service

2009-04-21 Thread Mohamed Amir
I am sorry, but the same code doesn't run now. I am testing on the emulator. Can it be a timing issue? if the service is invoked before the incoming call dialog captures the focus, it works because the activity is then on top of stack? On Apr 21, 2:57 pm, Mohamed Amir wrote: > OK, sorry, Dia