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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:35:17+00:00 2026-06-06T13:35:17+00:00

I am using following code. mDbHelper.open(); String[] areasList = new String[51]; for (int i

  • 0

I am using following code.

mDbHelper.open();
        String[] areasList = new String[51];
        for (int i = 0; i<51; i ++)
        {
            areasList[i] = "";
        }
        areasList = mDbHelper.getAllAreas();
        mDbHelper.close();

        ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, areasList);
        spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        chooseArea.setAdapter(spinnerArrayAdapter);

In debugger it shows all the values of String[] taken from database.

public String[] getAllAreas()
    {
        String[] areasList = new String[51];
        String queryString = "SELECT areaName FROM TFTaxi";
        Cursor resultSet =  mDb.rawQuery(queryString, null); 
        for (int i = 0; i<51; i ++)
        {
            areasList[i] = "";
        }
        int i = 1;
        areasList[0] = "Choose your Area";

        while(resultSet.moveToNext())
        {

            areasList[i] = resultSet.getString(resultSet.getColumnIndex("areaName"));
            i++;
        }

        resultSet.close();
        return areasList;
    }

But then it gives error

06-27 23:40:43.882: E/AndroidRuntime(16467): FATAL EXCEPTION: main
06-27 23:40:43.882: E/AndroidRuntime(16467): java.lang.NullPointerException
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:192)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.Spinner.onMeasure(Spinner.java:285)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.View.measure(View.java:12723)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:594)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:376)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.View.measure(View.java:12723)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:594)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:376)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.View.measure(View.java:12723)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.View.measure(View.java:12723)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:812)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.View.measure(View.java:12723)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.View.measure(View.java:12723)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.os.Looper.loop(Looper.java:137)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.app.ActivityThread.main(ActivityThread.java:4424)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at java.lang.reflect.Method.invokeNative(Native Method)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at java.lang.reflect.Method.invoke(Method.java:511)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-27 23:40:43.882: E/AndroidRuntime(16467):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-27 23:40:43.882: E/AndroidRuntime(16467):    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-06-06T13:35:18+00:00Added an answer on June 6, 2026 at 1:35 pm
    06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394)
    06-27 23:40:43.882: E/AndroidRuntime(16467):    at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
    

    from above error it’s clear the error is due to any of areasList[i] is null….see line 394

    text.setText(item.toString());

    • before iterating set cursor to first cursor.moveToFirst().

    .

     cursor.moveToFirst();
            do {
    
    
            } while (cursor.moveToNext());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to append param to url. This is working fine
I am using following code to connect with WPA2 in android (I can connect
I am using following code to get the path of the service... string ServicePath
i am using following code in android to get IMEI number of phone TelephonyManager
I am sending file using following code in my android application : Intent intent
i am using following code $doc = new DOMDocument(); $doc->strictErrorChecking = false; @$doc->loadHTML($data); $xpath
Android: I am using following code to insert image into album According to description
I created a DB using following code. Dim conn As New SqlConnection(Server=.\SQLExpress;Data Source=;Integrated Security=SSPI)
I am using following code UiApplication.getUiApplication().invokeLater(new Runnable(){ public void run(){ // your code here
I am creating HTML using following code : NSString *string = [NSString stringWithFormat: @<html>

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.