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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:59:06+00:00 2026-05-26T13:59:06+00:00

Im stuck trying to figure out how to pull the information from my pre-populated

  • 0

Im stuck trying to figure out how to pull the information from my pre-populated database that is in my assets folder to display in a tablelayout view. If you know of any clear tutorials or if you know how to do it could you please help me out.

Example of what I mean:

Database example:

            Mountains      Valleys    Rivers      Oceans

Vermount yes no yes no

kentucky no yes yes no

South Dakota yes no no no

(In the app if I was to display a specific row then the tablelayout should appear like this)

TableLayout View

           South Dakota         <--(I know how to put the header)

      Mountains       yes
      Valleys          no
      Rivers           no
      Oceans           no
  • 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-26T13:59:07+00:00Added an answer on May 26, 2026 at 1:59 pm

    I had to do something similar, but didn’t need a cursor. Here is what I ended up doing for my project. It takes in a dialog that displays the infinite progress spinner.

    private class AsyncPop extends AsyncTask<Dialog, Integer, ScrollView>
    {
        @Override
        protected void onPostExecute( ScrollView result )
        {
            setContentView( result );
            super.onPostExecute( result );
        }
    
        @Override
        protected ScrollView doInBackground( Dialog... params )
        {
            Dialog d = params[0];
    
            Connection con = StaticDBHelper.getCon( TabActivityDetail.this.getParent() );
            Statement st = null;
    
            List<Timestamp> date = new ArrayList<Timestamp>();
            List<String> text = new ArrayList<String>();
            try
            {
                st = con.createStatement();
                String sql = "select activityDateTime, detailText from xfu_ActivityDetail order by activityDateTime desc";
                st.execute( sql );
                ResultSet rs = st.getResultSet();
    
                while( rs.next() )
                {
                    date.add( rs.getTimestamp( "activityDateTime" ) );
                    text.add( rs.getString( "detailText" ) );
                }
                rs.close();
    
            }
            catch( SQLException e )
            {
                //Can't do a whole lot about it right now, should log
            }
            finally
            {
                if( null != st )
                {
                    try
                    {
                        st.close();
                    }
                    catch( SQLException e )
                    {
                        //Just ignore it, should log
                    }
                }
            }
            //Formatting
            ViewGroup.LayoutParams textBoxp1 = new ViewGroup.LayoutParams( 130, ViewGroup.LayoutParams.WRAP_CONTENT );
            ViewGroup.LayoutParams textBoxp2 = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT );
            TableRow.LayoutParams rowp1 = new TableRow.LayoutParams( 130, TableRow.LayoutParams.WRAP_CONTENT );
            TableRow.LayoutParams rowp2 = new TableRow.LayoutParams( TableRow.LayoutParams.FILL_PARENT,
                    TableRow.LayoutParams.WRAP_CONTENT );
            TableLayout.LayoutParams table1 = new TableLayout.LayoutParams( TableLayout.LayoutParams.FILL_PARENT,
                    TableLayout.LayoutParams.FILL_PARENT );
    
            TableLayout tableView = new TableLayout( _context );
            tableView.setLayoutParams( table1 );
            if( date.size() == 0 )
            {
                TextView dateView = new TextView( _context );
                dateView.setText( "No activity details availible for given filter" );
                dateView.setTypeface( Typeface.DEFAULT, Typeface.BOLD );
    
                TableRow row = new TableRow( _context );
                row.setLayoutParams( new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT ) );
                row.addView( dateView );
                tableView.addView( row, new TableLayout.LayoutParams( LayoutParams.FILL_PARENT,
                        LayoutParams.WRAP_CONTENT ) );
            }
            else
            {
                for( int index = -1; index < date.size(); index++ )
                {
                    TableRow row = new TableRow( _context );
                    TextView dateView = new TextView( _context );
                    TextView textView = new TextView( _context );
    
                    if( index == -1 )
                    {
                        dateView.setText( "Date / Time" );
                        textView.setText( "Detail Text" );
                        dateView.setTypeface( Typeface.DEFAULT, Typeface.BOLD );
                        textView.setTypeface( Typeface.DEFAULT, Typeface.BOLD );
                    }
                    else
                    {
                        dateView.setText( LoaderV5._fm.format( date.get( index ) ) );
                        textView.setText( text.get( index ) );
                    }
                    dateView.setLayoutParams( textBoxp1 );
                    textView.setLayoutParams( textBoxp2 );
    
                    row.setLayoutParams( rowp2 );
                    row.addView( dateView, rowp1 );
                    row.addView( textView, rowp2 );
                    tableView.addView( row, table1 );
                }
            }
            //tableView.setColumnShrinkable( 1, true );
    
            HorizontalScrollView otherscroller = new HorizontalScrollView( _context );
            otherscroller.addView( tableView );
    
            ScrollView scroller = new ScrollView( _context );
            scroller.addView( otherscroller );
            scroller.setHorizontalScrollBarEnabled( true );
    
            d.dismiss();
            return scroller;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing a database and I'm stuck trying to figure out what sort of
I'm trying to figure out how to display a menu that has been created,
I've been stuck trying to figure out why a counter cache on my (parent)
I am stuck trying to figure out how to initiate a WSDL connection with
I'm trying to automate file comment headers. I'm stuck trying to figure out how
I'm stuck again trying to figure out how to out the button clicked to
So I'm stuck trying to figure out how Google Analytics avoids spoofing. Sure, when
I am stuck trying to figure out how to alter my collision detection to
I am stuck trying to figure out how to declare lists of lists (of
I am stuck trying to figure out a way of checking if a user

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.