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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:34:12+00:00 2026-05-25T09:34:12+00:00

Here is my code of fetching the data from ArrayList : getTables=new Runnable() {

  • 0

Here is my code of fetching the data from ArrayList :

 getTables=new Runnable()
    {
        @Override
        public void run() 
        {
            db.open();
            try 
            {  

                tables =  db.showAllTable();    
                 for(int i=0;i<db.showAllTable().size();i++)
                 {
                        System.out.println("=====>"+(i+1));
                        System.out.println("Table :"+tables.get(i).toString());
                 }

                 customAdapter=new ImageAdapter(ListofTests.this, R.layout.list_row,tables);

            } 
            catch (Exception e) 
            {
                e.printStackTrace();
            }
            //setListAdapter(customAdapter);
            runOnUiThread(hideProgressBar);
            db.close();
        }
    };

And Here is My ImageAdapter class:

class ImageAdapter extends ArrayAdapter<Object> 
{

    private ArrayList<Object> tables;
    //ImageLoader imageLoader;
    Context m_context;
    public ImageAdapter(Context context, int textViewResourceId,ArrayList<Object> items) 
    {
        super(context, textViewResourceId, items);
        m_context=context;
        //this.tables = tables;
    }
    public View getView(final int position, View convertView, ViewGroup parent) 
    {
        View v = convertView;
        ViewHolder holder = null;

        if (v == null) 
        {

            try
            {
            holder=new ViewHolder();
            //imageLoader=new ImageLoader(CustomSearch.this);
            LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.list_row, null);
            holder.table_name=(TextView) v.findViewById(R.id.table_name);

            v.setTag(holder);

            }
            catch(Exception e)
            {
                System.out.println("Excption Caught"+e);
            }
        }
        else
            holder=(ViewHolder)v.getTag();

        Object table = tables.get(position);

        if(table!=null)
        {
            holder.table_name.setText("Hello");
        }

        return v;

    }
}

Now i dont know where i am wrong. I cant able to see the List of data in list view.
Please help me regarding this.
Thanks.

Error Log:

09-02 14:14:13.654: ERROR/AndroidRuntime(771): FATAL EXCEPTION: main

09-02 14:14:13.654: ERROR/AndroidRuntime(771): java.lang.NullPointerException
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at com.quiz.spellingquiz.ListofTests$ImageAdapter.getView(ListofTests.java:143)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.AbsListView.obtainView(AbsListView.java:1315)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.ListView.onMeasure(ListView.java:1109)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.View.measure(View.java:8171)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:563)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:378)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.View.measure(View.java:8171)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.View.measure(View.java:8171)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.View.measure(View.java:8171)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.View.measure(View.java:8171)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.View.measure(View.java:8171)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.os.Looper.loop(Looper.java:123)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at java.lang.reflect.Method.invoke(Method.java:521)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-02 14:14:13.654: ERROR/AndroidRuntime(771): at dalvik.system.NativeStart.main(Native Method)

  • 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-25T09:34:13+00:00Added an answer on May 25, 2026 at 9:34 am

    You never set tables in your Adapter

    I think you want this:

     public ImageAdapter(Context context, int textViewResourceId,ArrayList<Object> items) 
        {
            super(context, textViewResourceId, items);
            m_context=context;
            this.tables = items; // set to items instead of tables (which doesnt exist in the argument list)
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fetching some data from FB using the following code: dynamic parameters = new
Here is link where i got a code for web-page content fetching. But i
Here is code from MSDN . I don't understand why the work isn't just
Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
Possible Duplicate: Sending and Parsing JSON in Android I am fetching JSON Data from
I have the following code to fetch the data from URL, store it in
Hi I am fetching data for List View from web and want to set
I am fetching data from the following database: I have arduino-box that send that
Ok the error is showing up somewhere in this here code if($error==false) { $query
enter code here I have a table on SQL server 2005 with bigint primary

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.