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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:24:14+00:00 2026-06-16T01:24:14+00:00

I have to view the data of a SQLite database in a table, now

  • 0

I have to view the data of a SQLite database in a table, now the problem is that all the gridView sample that I have seen are implemented with a single array that defines all data of the table

public class GridViewDemo extends Activity implements
        AdapterView.OnItemClickListener {

    TextView selection;
    String[] items = { "this", "is", "a", "really", "really2", "really3",
            "really4", "really5", "silly", "list" };

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
        selection = (TextView) findViewById(R.id.selection);

        GridView gv = (GridView) findViewById(R.id.grid);

        ArrayAdapter<String> aa = new ArrayAdapter<String>(
                this,
                android.R.layout.simple_list_item_1, 
                items );

        gv.setAdapter(aa);
        gv.setOnItemClickListener(this);
    }

    public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
        selection.setText(items[position]);
    }

}// class

at the link

Because I don’t know how many rows will contains the data set selected by the user I should implement a gridView that receives different data arrays for each column.

Es

String dataColumn1[]=....
String dataColumn2[]=....
String dataColumn3[]=....

Or alternatively a method that limit the rows to a specified int, so also with a single array I could solve my problem.

  • 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-16T01:24:15+00:00Added an answer on June 16, 2026 at 1:24 am

    I should implement a gridView that receives different data arrays for
    each column.

    You could easily implement this by making your own custom adapter and getting the cell item from the correct data array using the position parameter in the getView method. The catch is that you need to find out which of the column has the biggest number of items and insert fake items in the other data arrays to match that number so you keep the GridView in the correct state.

    Or alternatively a method that limit the rows to a specified int, so
    also with a single array I could solve my problem.

    I didn’t understand this, the number of rows in the GridView is predetermined by the number of columns and the available data(if you have set 5 columns and you have 6 data items, you’ll have 2 rows in the GridView).

    You may also want to look at implementing the table with a ListView(I’ve answered a question that might be useful for this).

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

Sidebar

Related Questions

I have a Favorites view, that loads data from an sqlite database. It loads
I have a table view which is populated from data from an SQLite database.
I have a listView which loads data from SQLite database and right now I
I have a view that takes data from my site and then makes it
I have a an object view with data and a button on that view.
I have 5 view which have deferent json data , in all my 5
I have a view controller that gets presented modally and changes some data that
I have a view that I would like to populate data when the next
I have an iPhone app which has a Table View-based data input screen with
I have an events app which gets events data from sqlite database and displays

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.