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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:04:03+00:00 2026-06-04T17:04:03+00:00

I have some classes that used to inherit from ListActivity directly. Everything worked. Now

  • 0

I have some classes that used to inherit from ListActivity directly. Everything worked. Now I am inheriting from BaseListActivity which inherits from ListActivity.

Here is BaseListActivity:

public class BaseListActivity extends ListActivity 
{
    @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( BaseListActivity.this , ProblemioActivity.class);
              BaseListActivity.this.startActivity(myIntent);
            }
        });                 

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

It basically adds a header to the page. But now none of the lists get rendered and there are no exceptions.

Any idea what else I had to do to make it work?

Here is how I changed my original layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:orientation="vertical" >    


<include android:id="@+id/header"
         layout="@layout/header"
         android:layout_height="wrap_content"
         android:layout_width="fill_parent"/>    


<TextView
    android:id="@+id/question_label"    
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Loading your questions..."
    />     

    <ListView
    android:id="@android:id/list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label"
        android:textSize="20px" >        
    </ListView>

Here is my onCreate

public class MyQuestionsActivity extends BaseListActivity
{
    ArrayAdapter<Question> adapter;     

    ArrayList<Question> questions = new ArrayList <Question>( );        

@Override
    public void onCreate(Bundle savedInstanceState) 
{   
    super.onCreate(savedInstanceState);

    setContentView(R.layout.users_questions);

    Question q = new Question ();
    q.setQuestion( "" );

    questions.add(q);       

    adapter = new ArrayAdapter<Question>(this, R.layout.user_question_list, questions);

Right now I have this in my BaseListActivity

@Override
    public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);      
    {

I just tried this:

public class BaseListActivity extends ListActivity 
{
    @Override
    public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);      
    {
        setListAdapter(this.getListAdapter());

but it didn’t quite work 🙁

  • 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-04T17:04:04+00:00Added an answer on June 4, 2026 at 5:04 pm

    Please see this

    http://jnastase.alner.net/archive/2011/08/08/custom-android-listactivity.aspx

    http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/

    is there this line in onCreate ………
    setContentView(R.layout.main);

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

Sidebar

Related Questions

I have an interface, and some classes that inherit from it. public interface IFoo
I have some functionality that I need in all my classes which derive from
I have some methods that are used by several classes. My idea was to
I have 2 classes that inherit from a common base class. Each of these
I have a class called ItemBase from which a number of classes inherit. In
I have some classes that are used as Singletons. They share some basic functionality
I have an application which has some classes that handle some specific functions, have
I have questions about inheriting(extending) methods from classes and hiding some classes and methods
I have some WCF methods that are used to transmit information from a server
I have some classes that represent immutable objects (Quantity, Price, Probability). Is there some

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.