Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8167833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:19:43+00:00 2026-06-06T20:19:43+00:00

I have a list Fragment (importing the v4 support library, build target is 2.3.3

  • 0

I have a list Fragment (importing the v4 support library, build target is 2.3.3 api 11)
and the following problem in my code that was working fine when the target was 3.0 and I didn’t use the library.

Fragment frag1 = new ExampleFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.contentframe, frag1);
ft.commit();

Now I’m getting the compile error that

"Type mismatch: cannot convert from ExampleFragment to Fragment"

and it tells me to change the “Fragment” to ExampleFragment (e.g.)

ExamplesFragment frag1 = new ExamplesFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.contentframe, frag1);
ft.commit();

Then I have a problem that the ft.replace command has an error:

The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, Fragment_PVAnn)

and it tells me to change the ExamplesFragment in the first line back to just Fragment and so the circle goes round and around

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:19:45+00:00Added an answer on June 6, 2026 at 8:19 pm

    You should use

    getActivity().getSupportFragmentManager()
    

    If that is still giving you problems, then makre sure that your Activity extends FragmentActivity.

    If that is still giving you problems,

    1. Delete all of your imports,
    2. Re-import with Ctrl + Shift + O, and
    3. On every name clash, make sure you import from support.v4.*, not android.*.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Android-support-v4 I have a PagerAdapter that displays a list fragment in each
I have defined in XAML a list view, see following fragment: <Grid> <Button Content=_Generate
I have this fragment that demonstrates the problem: <html> <head> <title>height query demo</title> <script
I have the following XSD fragment that is from a Vendor, I can't change
I have a reusable HTML fragment that I use to list items. So to
I have the following code where frag is a list of strings which are
I have a xsl:variable ($features-list) specified in my XSL which contains a tree fragment
I am working on a Fragment application in Android 2.2. It so happens that
Ok so I have a fragment that I want to display two TextViews and
I have an XmlReader that is trying to read text into a list of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.