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

  • Home
  • SEARCH
  • 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 7996913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:49:46+00:00 2026-06-04T14:49:46+00:00

I have a BaseActivity which has my header: public class BaseActivity extends Activity {

  • 0

I have a BaseActivity which has my header:

public class BaseActivity extends Activity
{
        @Override
        public void setContentView(int layoutResID) {
            super.setContentView(layoutResID);      
        {
            Button home_header = (Button)findViewById(R.id.home_header);
            Button questions_header = (Button)findViewById(R.id.questions_header);

            home_header.setOnClickListener(new Button.OnClickListener() 
            {  
                public void onClick(View v) 
                {                   
                  Intent myIntent = new Intent( BaseActivity.this , ProblemioActivity.class);
                  BaseActivity.this.startActivity(myIntent);
                }
            });                 

            questions_header.setOnClickListener(new Button.OnClickListener() 
            {  
                public void onClick(View v) 
                {                   
                  Intent myIntent = new Intent( BaseActivity.this , MyQuestionsActivity.class);
                  BaseActivity.this.startActivity(myIntent);
                }
            });         
        }
    }
}

It works when I extend it like this:

public class ProblemActivity extends BaseActivity

but if I have a class which extends a ListActivity, I can not also extend the BaseActivity. Is there a way for me to force the classes that extend ListActivity to also be able to have the header? Right now I make them have the header by extending the BaseActivity, but since some extend ListActivity already, I can’t seem to do it that way.

How can I get around this and make the classes that extend the ListActivity also be able to have the header?

Thanks!

  • 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-04T14:49:48+00:00Added an answer on June 4, 2026 at 2:49 pm

    You can make BaseActivity extend from ListActivity, but this will make all your activities a ListActivity and probably will create problems to other activities that aren’t a ListActivity.

    ListActivity isn’t required to use ListView. You can use ListView in plain activities. If you want to continue using a BaseActivity for all your activities, then don’t use ListActivity and manage ListView by yourself. Another alternative would be to make your own ListActivity that extends from BaseActivity. Here’s a basic example of this:

    class MyBaseListActivity extends BaseActivity {
    
      protected ListView getListView() {
        return (ListView)findViewById(android.R.id.list);
      }
    
      protected ListAdapter getListAdapter() {
        return getListView().getAdapter();
      }
    
      ...
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my own base abstract class which extends Activity class. public abstract class
i have written the code like below public class SplashScreen extends BaseActivity{ public void
I wish to have a single class which all of my Activity classes extend.
Have following setup: MainActivity class - extends activity MyLayout class - extends View Prefs
Say i have com.mydomain.myappname. Is it a good idea to put my baseActivity class
I currently have this code that creates 4 tabs using tabactivity: public class toknapp
In my Android application i have a tracker activity in which i retrieve the
Have a matrix report now that has Position, Hours and Wages for a location
I am writing an Android app. I have an activity in my main project
Can Somebody can tell what is need of application class . I have read

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.