2013年8月28日星期三

Android Some activity which can not adjust the volume

There is some activity in the application can not adjust the volume, press the volume keys of the system shows that only the sound but no bar to adjust the volume , the volume can not be adjusted .
The following is a fragment of Manifest

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16"/>
   
    <uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:name=".IpvsApplication">
       
        <activity
            android:name=".InitActivity"
            android:theme="@android:style/Theme.NoTitleBar"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

activity code
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_init);

// app = (IpvsApplication) getApplication();
// app.setCallBack(callback);
}

commented out , this activity basically did not do anything . Which heroes have encountered such a problem, but also hope the wing
------ Solution ------------------------ --------------------
public boolean onKeyDown (int keyCode, KeyEvent event) {

if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
{
return true;
}
else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP)
{
return true;
}

return super.onKeyDown (keyCode, event);
}
------ reference ----------------------------------- ----


MD, dawned ! ! know where is the problem , thank you .

没有评论:

发表评论