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 6845943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:33:47+00:00 2026-05-27T00:33:47+00:00

I have to write an app for both phones and tablets and I would

  • 0

I have to write an app for both phones and tablets and I would like to use the same project for both. It seems the use of compatibility library is good to write reusable code.

Is possible to share the same Fragment class for both?

I’m thinking about a starting activity that “forks” the app in pre-honeycomb activities and post-honeycomb, reusing the same Fragment classes. The fact is if I include android.app.Fragment, the fragment will not be usable from a FragmentActivity and viceversa.
I could use only FragmentActivities, but this would prevent the use of the actionbar.

How to do this?

  • 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-05-27T00:33:47+00:00Added an answer on May 27, 2026 at 12:33 am

    The solution in the example here does not seem to be appropriate.
    For contacts the problem is that there is a class that is deprecated but you can still compile it.
    With fragment if you refer to android.app.Fragment you can’t compile that class with the sdk < 3.0 while if use import android.support.v4.app.Fragment you can’t compile for honeycomb (you can only if you keep using the support lib even on honeycomb that does not seem to be the best thing to do).

    I managed to do it only by having two different projects that expose two different implementations of a proxy. Than I use the right implementation for each sdk. It is not as simple as it looks because you will have to make a proxy for FragmentTransaction, FragmentManager etc.

    It worked for me but it did not work for settings with fragment. In that case the xml files that use fragment can’t be compiled with pre honeycomb sdk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to write a C app that will act as both UDP sender
I need to have both earlier and later versions of App I write in
I'm writing a simple web app in PHP that needs to have write access
Does anyone have any advice how to write such app? Or maybe knows some
So, there is problem - I have the order to write web-app on Kohana
I'm wanting to write a whiteboard app. I have a beginning that renders a
I have been asked to write a compliment website/service for an iPhone app. The
We have a database app that we're beginning to write some new systems for
I'm trying to write my first simple mvc app. I have a Main View
Just trying to write my first ever WP7 app. I have several hundreds 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.