Question

Greetings and salutations,

Short Version: I am trying to make use of DialogFragment in my Android Application which has a minSkdVersion of 8 (Android 2.2). In order to make use of them, I must be able to call "getSupportFragmentManager()". In order to do this, I tried altering the calling Activity to a FragmentActivity, which allowed getSupportFragmentManager() to resolve at run time, but when trying to create that intent at runtime I get a NoClassDefFoundError as the application can't resolve something upstream of it

W/dalvikvm(333): Unable to resolve superclass...

That being the case, how can I call getSupportFragmentManager() from a simple Activity without making that activity a FragmentActivity (which failed to work)? Or do I need to make the activity into a FragmentActivity, but I need to make a few other changes to make it work?

Just for the record: I have added the android-support-v4.jar to the project already (otherwise, I'd not be able to compile at all).

Thank you in advance for your assistance.

Was it helpful?

Solution

Since the FragmentActivity is the class that can't be found, I think I know what the problem is. Are you sure your compatibility library is getting included with your apk? You can use dex2jar to check this. It seems that you need to move your libraries to the libs folder for them to get included in newer revisions of the android tools.

OTHER TIPS

look at the examples of the support library . they extend from "FragmentActivity" in order to support those features.

they also write that you must extend it in order to use the support library: http://developer.android.com/reference/android/support/v4/app/FragmentActivity.html

FragmentActivity:

"Base class for activities that want to use the support-based Fragment and Loader APIs.

When using this class as opposed to new platform's built-in fragment and loader support, you must use the getSupportFragmentManager() and getSupportLoaderManager() methods respectively to access those features."

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