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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:40:50+00:00 2026-05-20T00:40:50+00:00

My current application has one Activity, the main one which extends ListActivity (listview of

  • 0

My current application has one Activity, the main one which extends ListActivity (listview of course).
The main Activity also holds most of the app functions.

I want to add an option for the user to select between 2 views: the current listView and a gridView.
I also want to reuse my code – most functions can be used for both Views.

Before I ask the actual question, note that my question is NOT how to add a gridView – it’s already added and works great (when commenting out all Listview lines).

My question is – how should I do it?

  • 2 different Views means I have to have 2 different Activities? one extends “ListActivity” and one extends “Activity”?

  • Should I create 4 classes (3 Activities and functions class in this case) where the main Activity will call one of the other Activities according to what the user selected?

  • Is there a way using the same main Activity for both Views? (right now I extend “ListActivity” to get “getListView()” which causes the gridView to force close as the Activity looks for a ListView with the ID “list”).

  • Any other way?

Thank you!

  • 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-20T00:40:51+00:00Added an answer on May 20, 2026 at 12:40 am

    You can use ListView without using a ListActivity. I would recommend this approach if the rest of your Activity’s code will be similiar for both the List and Grid forms. Choose dynamically which one you show and tailor your adapter definitions to do both based on a switch or if statement where needed, rather than using different Activities.

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

Sidebar

Related Questions

My current application has a JFrame with about 15 actions stored as fields within
My application has one table called 'events' and each event has approx 30 standard
We have an application that has one or more text console windows that all
We have a current application where user login credentials are stored in a SQL
In my current application I have a form that requires the user to enter
Using the method Application.Restart() in C# should restart the current application: but it seems
Is it possible to fetch the current application version programmatically for use in urls
I came across a problem in my current application that required fiddling with the
I have a pretty standard table set-up in a current application using the .NET
so I'm using LinQ2SQL quite heavily in my current application, and although I have

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.