Cannot resolve method 'getSupportFragmentManager ( )' inside Fragment
Inside a Fragment
subclass you have to use getFragmentManager
in place of getSupportFragmentManager
. You will get the support one if the import are from the support library.
Can not resolve method getSupportFragmentManager()
getSupportFragmentManager
is method of FragmentActivity
,not TabActivity
,so you just replace it with getFragmentManager()
.
Cannot resolve Method getSupportFragmentManager() or ((FragmentActivity)activity)getSupportFragmentManager()
You need an Activity to host that Fragment. A Fragment cannot be possible without a hosting Activity. At first, create an Activity (eg. AlarmActivity
) with transparent background (You can achieve with themes) which has a FragmentContainerView
to host your fragment. When you receive broadcast in your BroadcastReceiver
, start this activity:
Intent intent = new Intent(context, AlarmActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // This is required
context.startActivity(intent);
Cannot resolve method super() error in fragmentmanager Android
Using the super()
in a constructor you are trying to call the constructor of the parent class.
In this case the FragmentStateAdapter
has 3 constructors:
FragmentStateAdapter(FragmentActivity fragmentActivity)
FragmentStateAdapter(Fragment fragment)
FragmentStateAdapter(FragmentManager fragmentManager, Lifecycle lifecycle)
In your case you have:
public AuthenticationPagerAdapter(FragmentManager fragmentActivity)
and super(FragmentManager);
doesn't match any super constructor.
You can use something like:
public AuthenticationPagerAdapter(FragmentActivity fragmentActivity) {
super(fragmentActivity);
}
public AuthenticationPagerAdapter(FragmentManager fragmentManager,Lifecycle lifecycle) {
super(fragmentManager, lifecycle);
}
Android Fragment cannot resolve add method
@Courtesy To Md
Use import android.support.v4.app.Fragment
instead import android.app.Fragment
android.support.v4.app.Fragment is the Fragment class in the android support library, which is a compatibility package that allows you to use some of the newer features of Android on older versions of Android.Reference
Please add this in your gradle dependencies
compile 'com.android.support:support-v4:22.1.1'
Related Topics
Android Httpclient Hangs on Second Request to the Server (Connection Timed Out)
Android Save Images to SQLite or Sdcard or Memory
Get Selected Text from Textview
Mediaplayer Error (1, -1004) Aka Media_Error_Io Trying to Stream Music on Samsung S3
How to Implement Placeautocompletefragment and Placeautocompleteactivity to Get Place Details
After Upgrading to Google Play Services 9.0.0, App Hangs in Dynamitemodulesc
Running a Specific Instrumentation Unit Test with Gradle
Travis Ci Failed Because Cannot Accept License Constrain Layout
Google Sceneform - Is It Deprecated? Any Replacement
Android 1.5: Reading Sms Messages
Recyclerview Steals Focus When Inside a Nestedscrollview
Overridependingtransition Does Not Work When Flag_Activity_Reorder_To_Front Is Used
How to Dismiss Alertdialog in Android