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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:09:32+00:00 2026-05-27T07:09:32+00:00

In the application I am writing, I have a main class which extends the

  • 0

In the application I am writing, I have a main class which extends the ListActivity – it contains a list of elements. I want these elements to link to a different page (an xml one, or perhaps a View object). However, I realised one cannot use the method setContentView(int) on a ListActivity object.

What’s to be done?

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-05-27T07:09:33+00:00Added an answer on May 27, 2026 at 7:09 am

    Looks like you are trying to launch a new activity.

    You have to override the onListItemClick method of ListActivity.

    Here is the code.

    // ListView l points to list view whose item user clicked
    // View v points to the item in the list view on which the user clicked
    // int position is the position index of the item in the list
    // long id is the id assigned to the item. This id is assigned using the ListAdapter, CursorAdapter etc.
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
    
        // I am using getApplicationContext() as it is more safe then just passing `this`
        Intent i = new Intent(this.getApplicationContext(), ActivityToRun.class);
    
        this.startActivity(i);
    }
    

    NOTE: You have to improve on this skeleton depending upon your needs.

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

Sidebar

Related Questions

I'm writing an application on qooxdoo. I have a class, which should return table
I am writing an application, where I do have few different windows implemented, where
I am writing a library, which is dynamically loaded in my main-application with dlsym.
i am developing an iphone application in which i have 3 classes => main
Let's say I'm writing an application which works with projects, and exposes different functionality
I am writing an Android application with a main page being a list of
I have an application I’m writing in access with a SQL server backend. One
I am writing an application that writes to SQL Compact files that have a
I have just been involved in writing an application that does not use Doctype's
I am writing an application in java (1.6) using swing. I currently have a

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.