Disable the button until it is usable.

On Mon, Jun 4, 2012 at 9:57 AM, Greenhand <cooperateonl...@gmail.com> 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 initialized and mBound is false until the mConnection callback is
> called. In the sayHello(), it uses "if (!mBound) return;" to prevent
> null pointer exception but user will perceived that the button is not
> working before the callback is called. Is there a better way to solve
> it?
>
> On 6月4日, 下午9時20分, Mark Murphy <mmur...@commonsware.com> wrote:
>> On Mon, Jun 4, 2012 at 9:17 AM, Greenhand <cooperateonl...@gmail.com> wrote:
>> > In onDestroy(), I checked whether theActivityis finishing and bound.
>> > If so, I unbindService().
>> > if(isFinishing() && serviceBound){
>> >    unbindService(serviceConnection);
>> >    Log.d("MyMediaPlayerActivity","Activity: unbindService()");
>> > }
>>
>> That needs to be
>> getApplicationContext().unbindService(serviceConnection). If you bind
>> using getApplicationContext(), you unbind using
>> getApplicationContext().
>>
>> --
>> Mark Murphy (a Commons 
>> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>>
>> Android Training in DC:http://marakana.com/training/android/
>>
>>
>
> --
> 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



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

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

Reply via email to