Monday, April 30, 2012

Re: [android-developers] public variables

Why are you holding onto a static Context reference?  Your Activity IS a context.  I have never done anything with MediaPlayer but I doubt it needs to be static either.

and shows an error..I can not recognize errorfrom logcat...What iam doing wrong?
Telling us what the error is might be helpful...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Apr 30, 2012 at 11:17 AM, jadranko bodiroga <jadrankobodiroga1985@gmail.com> wrote:
ok..i have other question...i make code

if (AppSettings.playSounds)
{
play.mp.start();   //////////play is a  another class which i what to start music what i input in play-class
}



import android.app.Activity;
import android.content.Context;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;

public class play extends Activity{
   
    public static Context context;
    public static MediaPlayer mp=MediaPlayer.create(context, R.drawable.klik);

}


and shows an error..I can not recognize errorfrom logcat...What iam doing wrong?

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment