Code example for AudioManager

Methods: isMusicActive

0
        am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        IntentFilter iF = new IntentFilter();
        iF.addAction("com.android.music.playstatechanged");
        iF.addAction("com.android.music.metachanged");
        mContext.registerReceiver(mMusicReceiver, iF);
        mIsMusicActive = am.isMusicActive();
    } 
 
    public void setupControls() { 
        Slog.d(TAG, "Setting Up Music Controls");
        LinearLayout ll = new LinearLayout(mContext);
        ll.setOrientation(LinearLayout.HORIZONTAL);
        ll.setGravity(Gravity.CENTER_HORIZONTAL);
 
	View controlsView = mInflater.inflate(R.layout.exp_music_controls, null, false);
	ll.addView(controlsView, BUTTON_LAYOUT_PARAMS);
	addView(ll, WIDGET_LAYOUT_PARAMS);
 
	updateControls(); 
    }