because if i create media used the Application point(), i can't hear
the sound
public void playAudio(int type) {
mMediaPlayer = MediaPlayer.create(this(or
getBaseContext()),
R.raw.online);
mMediaPlayer.start();
}
public static MyApplication getApplication(Activity activity) {
// TODO should this be synchronized?
if (app == null)
{
initialize(activity);
}
mActivity = activity;
return app;
}
I means if i finish the Activity B, The
You aren't supplying enough code to understand what you are doing (who is
calling getApplication()?). But I'll see again -- if you don't see the
pointer to null, then yes, you will never get a null back.
On Sun, Apr 26, 2009 at 11:32 PM, Neo mobi.liub...@gmail.com wrote:
public static
Application class
public class MyApplication extends Application{
public static MyApplication getApplication(Activity activity)
{
// TODO should this be synchronized?
if (app == null)
{
initialize(activity);
}
mActivity = activity;
If you are explicitly setting it, you will need to explicitly clear it at
some point, possibly in onDestroy().
Note that you need to be very careful when doing this kind of thing.
Generally the most safe global to store like this is the currently resumed
activity, set in onResume() and cleared in
5 matches
Mail list logo