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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:16:06+00:00 2026-05-14T06:16:06+00:00

Is it possible to have a single listview with 2 or more columns, operable

  • 0

Is it possible to have a single listview with 2 or more columns, operable with paging property (i.e. at a time listview will show only 4 items in single column and on press of right arrow it will show next 4 items )..
Can you please tell me the procedure to implement it or any idea?
Thanks
puneet

  • 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-14T06:16:06+00:00Added an answer on May 14, 2026 at 6:16 am

    Not sure if this is what you’re looking for, but basically this code creates a subset of objects based on the main dataset you’re using to populate your list. It goes something like this:

    import android.app.ListActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.ArrayAdapter;
    
    public class MainActivity extends ListActivity {
    
    // Constant for limiting array to match desired number of values in column
    private final int NUMBER_OF_ITEMS_IN_COLUMN = 4;
    
    // Index for starting point of array subset
    private int mStartingIndex = 0;
    
    // Data set array for list
    private String[] mDataSet = new String[]{ 
        "One", "Two", "Three", "Four", "Five", 
        "Six","Seven","Eight", "Nine", "Ten",
        "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", 
        "Sixteen", "Seventeen", "Eightteen", "Nineteen", "Twenty",
     };
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        changeListViewModel(0);
    }
    
    private void changeListViewModel(int startingIndex) {
    
     // Check staring index meets certain criteria
     if(startingIndex < 0) 
      startingIndex = 0;
     else if(startingIndex >= mDataSet.length)
      startingIndex -= NUMBER_OF_ITEMS_IN_COLUMN;
    
     // Set starting and ending index
     mStartingIndex  = startingIndex;
     int endingIndex = startingIndex + NUMBER_OF_ITEMS_IN_COLUMN;
    
     // Make sure ending index isn't outside the bounds of the data set array
     if(endingIndex > mDataSet.length) endingIndex = mDataSet.length;
    
     // Create subset and set listview adapter
     String[] subSet = getDataSubset(startingIndex, endingIndex);
     setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, subSet));
    }
    
    private String[] getDataSubset(int startingIndex, int endingIndex){
    
     String[] toRet = new String[endingIndex - startingIndex];
    
     int index = -1;
     for(int x = startingIndex; x < endingIndex; x++)
      toRet[++index] = mDataSet[x];
    
     return toRet;
    }
    
    /*
     * Called from layout main.xml file
     */
    public void backButtonClicked(View v) {
     changeListViewModel(mStartingIndex - NUMBER_OF_ITEMS_IN_COLUMN);
    }
    
    
    /*
     * Called from layout main.xml file
     */
    public void nextButtonClicked(View v) {
     changeListViewModel(mStartingIndex + NUMBER_OF_ITEMS_IN_COLUMN);
    }
    }
    

    It’s pretty basic, but it should be able to get your started. Plus, using something like this, you could also tie in the listview with a SQLite database by having a database class that returns a list of objects as a subset for the listview.

    You can download the source here: Download Source

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

Sidebar

Related Questions

My question is about memory use and objects in actionscript 2. If I have
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
I know its probably possible, but is it practical and doable to try and
I know its probably possible, but is it practical and doable to try and
I'm trying to build a Chrome browser extension, that should enhance the way the
This is beyond both making sense and my control. That being said here is
I am trying to load a html page through UIWebview.I need to disable all
I'm trying to write test harness for part of my Android mapping application. I
I am writing a query to fetch results for all the values in 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.