问题
I'm trying to customize the MediaController. While doing so, I've stumbled upon a problem. Both my slightly modified version and the unmodified source of MediaController won't compile with intelliJ IDEA. When compiling the unmodified source code I get these errors:
mWindow = PolicyManager.makeNewWindow(mContext);
Gives the error:
cannot find symbol
symbol : variable PolicyManager
location: class android.widget.MediaController
Next error:
if (event.getRepeatCount() == 0 && event.isDown() && (
keyCode == KeyEvent.KEYCODE_HEADSETHOOK ||
keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE ||
keyCode == KeyEvent.KEYCODE_SPACE))
Gives the error:
Cannot find symbol
symbol : method isDown()
location: android.view.KeyEvent
My modified code also gives the above errors but also two more:
FrameLayout.LayoutParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT
);
Gives the error:
cannot find symbol
symbol : variable LayoutParams
location: class android.widget.FrameLAyout
Next error:
addView(v, frameParams);
Gives the error:
cannot find symbol
symbol : variable frameParams
location: class ........
I would be most thankful for any help.
I got the source code from GrepCode, http://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.android/android/2.0_r1/android/widget/MediaController.java/?v=source
回答1:
MediaController
requires access to classes and methods that are not part of the Android SDK, and therefore cannot be built as part of a regular SDK application.
来源:https://stackoverflow.com/questions/14775232/compilation-errors-with-android-widget-mediacontroller