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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:47:05+00:00 2026-06-10T15:47:05+00:00

What is happening here in my app is that I get a column from

  • 0

What is happening here in my app is that I get a column from the database, which works cause when I System.out.println() it shows exactly what I want in an arraylist format, I then try to pass that to another class and I keep getting an error. Anyone know why this is happening? Please if you can show code, thank you in advance.

The Code from my Main Class (pretty lengthy so only linking a small portion):

//Declarations at the top
ArrayList<String> roles = new ArrayList<String>();
AFragmentTabDB aFDB;
DataBaseHelper myDB;

//Trying to pass the arraylist to another class called aFDB
roles = myDB.getTableColumn("role", new String[] {"name"});
System.out.println(roles);  
aFDB.setRoleList(roles);

Here is the class I am trying to pass this into:

public class AFragmentTabDB {


ArrayList<String> roles = new ArrayList<String>();

public void setRoleList(ArrayList<String> aL){
    this.roles = aL;

}

public ArrayList<String> getRoleList(){
    return roles;

}

}

Here is where my getTableColumn() is:

public class DataBaseHelper extends SQLiteOpenHelper{

    public ArrayList<String> getTableColumn(String tableName, String[] column){

    ArrayList<String> aL = new ArrayList<String>();

    cursor = myDataBase.query(tableName, column, null, null, null, null, null);

    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
      aL.add(cursor.getString(0));
      cursor.moveToNext();
    }

    cursor.close();
    return aL;
}
}
  • 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-10T15:47:06+00:00Added an answer on June 10, 2026 at 3:47 pm

    You haven’t constructed the AFragmentTabDB object so when you call setRoleList() you are calling that on a null object.

    Change your line from

    AFragmentTabDB aFDB;
    

    to

    AFragmentTabDB aFDB = new AFragmentTabDB();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(LocalVariable)ABC.string(Name) = (IDataReader)dataReader.GetString(0); This name value is coming from database. What happening here is
I've been trying to figure out what exactly is happening here. I'm just trying
I have a Rails app that I'm trying to deploy with Capistrano (which I've
I have an app that starts with a tableview (from a xib) that loads
I am implementing an app that uses the native language settings which can be
I have noticed in my adobe air app that I get intermitent crashes while
I have a Status-Bar item only app that Iam trying to get to show
So here is the thing. I'm making an app that uses backboneJS. I currently
We're using Phonegap to develop our mobile app, and we borrowed code from here
What's happening here : $ echo $SHELL /bin/bash $ echo -e foo foo $

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.