On Sat, Jan 7, 2012 at 11:05 AM, Raghav Sood
<[email protected]> wrote:
> Since I don't actually use an intent to
> start that activity, just directly call the play() and stop() methods, would
> it be possible that the onCreate() is never called, and mPlayer stays null?

Wait, whoa, what?

If I am interpreting you correctly, you have a subclass of Activity
that you are not launching via startActivity(), but are creating an
instance via a constructor.

In that case, the advice is very simple:

Never do that.

Never create an Activity instance via a constructor. Always use
startActivity(). If you aren't expecting this to actually show
something on the screen, then it should not be an Activity.

Not only is an Activity created via its constructor simply invalid for
pretty much all uses, but it certainly won't go through the lifecycle
progression (onCreate(), etc.).

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

Android Training in NYC: 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to