As for the broadcast solution, can an Activity receive a broadcast
while it is rotating? Will all the broadcasts sent to it be received?
About the Messenger, is it possible to create a Messenger from a
Service to an Activity? In the Messenger tutorial, it says "it sends a
Message to the service th
Also, if you are writing an app where you have a service that is just being
used by the code in that app (not being accessed by other apps), and not
looking for the startService semantics... you should probably stop and
make sure you really need a service at all. If you are just binding within
yo
Do please be careful about startService. You should only use one or the
other where you want the associated semantics:
- startService means "I want you do go off and do this work independently
of the caller, with the understanding that someone will take care of
stopping the service as soon as it
On Mon, Jun 4, 2012 at 11:30 AM, Greenhand wrote:
> If I use startService(), can the Activity communicate with the Service
> and vice versa?
startService() uses a variation of the command pattern: you
"communicate" with the service via extras on the Intent passed to
startService() as the command.
If I use startService(), can the Activity communicate with the Service
and vice versa?
On 6月4日, 下午11時15分, Mark Murphy wrote:
> Don't use bindService(). Use startService().
>
> On Mon, Jun 4, 2012 at 11:11 AM, Greenhand wrote:
> > If I change the MessengerService into an media player service, a u
Don't use bindService(). Use startService().
On Mon, Jun 4, 2012 at 11:11 AM, Greenhand wrote:
> If I change the MessengerService into an media player service, a user
> can control the media player by the ServiceConnection in the Activity
> and the media player service can update the UI according
If I change the MessengerService into an media player service, a user
can control the media player by the ServiceConnection in the Activity
and the media player service can update the UI according to the state
of media player. The downside is that the playback will be stopped
when a user leaves the
Thank you!
On 6月4日, 下午10時05分, Mark Murphy wrote:
> Disable the button until it is usable.
>
>
>
>
>
> On Mon, Jun 4, 2012 at 9:57 AM, Greenhand wrote:
> > It works! The context is so mysterious in Android.
>
> > Another question, in the tutorial (http://developer.android.com/guide/
> > topics/fu
Disable the button until it is usable.
On Mon, Jun 4, 2012 at 9:57 AM, Greenhand wrote:
> It works! The context is so mysterious in Android.
>
> Another question, in the tutorial (http://developer.android.com/guide/
> topics/fundamentals/bound-services.html#Messenger), the mService is
> not initi
It works! The context is so mysterious in Android.
Another question, in the tutorial (http://developer.android.com/guide/
topics/fundamentals/bound-services.html#Messenger), the mService is
not initialized and mBound is false until the mConnection callback is
called. In the sayHello(), it uses "if
On Mon, Jun 4, 2012 at 9:17 AM, Greenhand wrote:
> In onDestroy(), I checked whether the Activity is finishing and bound.
> If so, I unbindService().
> if(isFinishing() && serviceBound){
> unbindService(serviceConnection);
> Log.d("MyMediaPlayerActivity","Activity: unbindService()");
> }
Th
In onDestroy(), I checked whether the Activity is finishing and bound.
If so, I unbindService().
if(isFinishing() && serviceBound){
unbindService(serviceConnection);
Log.d("MyMediaPlayerActivity","Activity: unbindService()");
}
On 6月4日, 下午9時04分, Greenhand wrote:
> I added following two me
2012/6/4 Greenhand
> if(serviceBound == false){
>bindService(new
> Intent(getApplicationContext(),MessengerService.class),
> serviceConnection, BIND_AUTO_CREATE); //!!!
>Log.d("MyMediaPlayerActivity","Activity: bindService()");
> }else{
>Log.d("MyMediaPlayerActivity","Activity: servic
I added following two methods in my Activity:
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putBoolean("serviceBound", serviceBound);
}
@Override
public Object onRetainNonConfigurationInstance() {
return serviceConnection;
}
And in onCreate() of the Activity, I ad
On Mon, Jun 4, 2012 at 5:06 AM, Greenhand wrote:
> I modify my code and use bindService(new
> Intent(getApplicationContext(), MessengerService.class), mConnection,
> Context.BIND_AUTO_CREATE) but my service still be killed and created
> with my Activity life cycle. Can you please illustrate "Don't
Why use addition instead of multiplication?
-- K
04.06.2012 14:06, sha m написал:
why shouldnt startservice/stopservice instead of bind/unbinding to
the service
--
Kostya Vasilyev
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To pos
why shouldnt startservice/stopservice instead of bind/unbinding to the
service
On Mon, Jun 4, 2012 at 3:15 PM, Kostya Vasilyev wrote:
>
> 04.06.2012 13:06, Greenhand написал:
>
> I modify my code and use bindService(new
>> Intent(getApplicationContext()**, MessengerService.class), mConnection
04.06.2012 13:06, Greenhand написал:
I modify my code and use bindService(new
Intent(getApplicationContext(), MessengerService.class), mConnection,
Context.BIND_AUTO_CREATE) but my service still be killed and created
with my Activity life cycle. Can you please illustrate "Don't unbind
in the old
I modify my code and use bindService(new
Intent(getApplicationContext(), MessengerService.class), mConnection,
Context.BIND_AUTO_CREATE) but my service still be killed and created
with my Activity life cycle. Can you please illustrate "Don't unbind
in the old activity instance -- only unbind from t
19 matches
Mail list logo