Reputation: 8978
I have a problem with API 17 AudioManager's method getProperty
Eclipse can't recognize this method and displays:
The method getProperty() is undefined for the type AudioManager
I have updated Eclipse and packages in Android SDK Manager. API 17 is installed and up to date.
Eclipse Version: 4.2.2
Build id: M20130204-1200
sample code:
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
Upvotes: 1
Views: 1745
Reputation: 161
make sure you have the sdk level set in your projects AndroidManifest.xml:
<uses-sdk android:targetSdkVersion="17" />
and just to be safe, in project.properties:
# Project target.
target=android-17
Upvotes: 0
Reputation: 58487
Works fine for me if I set the Android version for my project to 4.2.2.
String s = am.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
Right-click your project in the package explorer, click Properties
, Android
, set Project Build Target
to Android 4.2.2
and click Apply
.
Upvotes: 1