2011-09-15 6 views
1

私はタブのアクティビティを持つアンドロイドタブで作業しています。私はすべてのタブのタブグループを作っています。 メディアプレーヤーの音量を制御できません。アンドロイドデバイスの音量コントロールダイアログが表示されません。ここに私のコードはアンドロイドコードのメディアプレーヤーの音量管理の問題

mp=new MediaPlayer(); 
      mp.setWakeMode(getParent(), PowerManager.PARTIAL_WAKE_LOCK); //for powermanagement 
    try { 
       if(GlobalConfig.notInternet==true) 
       { 
        mp.setDataSource("/sdcard/abc/"+file); 
       }else{ 
        mp.setDataSource(url2); 
       } 
       mp.prepare(); 

      } catch (IllegalArgumentException e1) { 
       // TODO Auto-generated catch block 
       e1.printStackTrace(); 
    } 
    mp.start(); 

私を助けてください。事前のおかげで

答えて

0

次のコードは...メディアサウンドを管理するために使用されるべき

AudioManager mAudioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE); 

    //It gives max volume of ur device 

    int max_volume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); 

    //It gives current volume of device 

    int current_volume=mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC)); 
    //Here you can set volume 
    int progress=your set value; 
    mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,progress, 0);