Question

I am trying to create a popup menu and I keep getting java.lang.NoClassDefFoundError: android.widget.PopupMenu

    public void showPopup(View v) {
    PopupMenu popup = new PopupMenu(this, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.tweet_menu, popup.getMenu());
    popup.show();
}

I realize this error means that the class is found in the classpath at compile, but not at runtime, but I am having trouble figuring out why, as this is part of Android SDK. I am using the newest version of the SDK and I am developing/compiling in Netbeans.

Please help!

Was it helpful?

Solution

PopupMenu is available since Android API 11. So in order to use you need a device with at least Android 3.0. Please refer to the Android developers docs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top