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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:23:26+00:00 2026-06-11T15:23:26+00:00

In my app initially I created one class abc.java which extends Activity and do

  • 0

In my app initially I created one class “abc.java” which extends Activity and do some functionality..

But now I have decided to implement TabView and abc.java should be first tab in tabview..

My problem is my abc.java class extends activity and now when I change it to fragments , it gives me errors.

If I implement TabActivity , which is deprecated now, it will work fine, but now if I want to use fragment what changes I have to do?

I know I have to make some changes in abc.java but I have no clue how to do that..I am new to android and trying hard to get this done..Any help would be great!!

here is my code for class “abc.java”

public class CountAndMarkPage extends Activity
{
  public void onCreate(Bundle savedInstanceState)
  {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.count_mark);

        //lots of code here
   }
 }
  • 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-11T15:23:27+00:00Added an answer on June 11, 2026 at 3:23 pm

    You’ll need to extend Fragment and override onCreateView using the same layout resource. Have a look at this info from docs.

    Quick example:

    public class CountAndMarkPage extends Fragment {
        public void onCreate(Bundle savedInstanceState){
        }
    
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState){
            // Inflate your layout
            View myView = inflater.inflate(R.layout.count_mark, container, false);
    
            // Any additional initialization
    
            return myView;
        }
    }
    

    To access widgets within this layout, you’ll need to use findViewById on the inflated root view like so

    public class CountAndMarkPage extends Fragment {
        public void onCreate(Bundle savedInstanceState){
        }
    
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState){
            // Inflate your layout
            ViewGroup myView = (ViewGroup) inflater.inflate(R.layout.count_mark, container, false);
    
            // Any additional initialization
            TextView myTextView = (TextView) myView.findViewById(R.id.my_view);
            // And so on
            return myView;
        }
    }    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If a VS2008 project is created initially with a web app project, and class
Ok guys I am developing an iPhone app I have a Model class which
I have created one testing app for running deep counter loop. I run the
I have created edittexts in which user can enter numbers. In my app user
I have two activities, the one Main.java that initially loads I have a couple
I have a winforms app that initially displays a window with two file dialog
I use two Spinner in my App. One of them is initially disabled because
I am doing some initial testing for a Rails app which will be deployed
I have created the application which is based on Sqlite database. So in my
I have a grails app with a domain Restaurant and a domain Person. class

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.