ShrimpCrackers ShrimpCrackers - 4 months ago 31
Android Question

Why can't I override onAttachFragment?

I have a class extending from android.support.v4.app.Fragment. The documentation android.support.v4.app.Fragment shows that there is a method called

onAttachFragment(Fragment childFragment)
, but I can't override it in Android Studio. It's like it doesn't exist. Is there a reason for this, or is this an error in documentation?
android.app.Fragment
non-support version says it has been added in API level 24. That shouldn't matter though should it? Since I am using the support version which has the same class.

Edit:
Here are my dependencies in build.gradle

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':core-3.2.1')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:7.8+'
compile 'com.microsoft.azure.android:azure-storage-android:0.7.0@aar'
}

Answer

You're using the 23.4.0 release of the Support Library. Only the 24.X (i.e., 24.1.1) versions of the Support Library will contain the equivalent APIs added in API 24.

You'll need to upgrade your version of the Support Library to use the new APIs.