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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:13:25+00:00 2026-06-07T08:13:25+00:00

I’m getting a NullPointerException on my ArrayAdapter . I’m getting a value from a

  • 0

I’m getting a NullPointerException on my ArrayAdapter. I’m getting a value from a database connected to the localhost and When I post the value to the log cat and delete the textview.settext("something") my error is gone. But when I initialize the TextView and put something in it the error shows again.

Here is my snippet:

public class MySimpleArrayAdapter extends ArrayAdapter<String> {
    private final Context context;
    private final List<String> values;
    //private final List<String> arr;

    public MySimpleArrayAdapter(Context context, List<String> values) {
        super(context, R.layout.rowlayout, values);
        this.context = context;
        this.values = values;
    }

    static class ViewHolder {
        public TextView text;
        public ImageView image;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Log.i("List",values.get(position).toString());
        LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        ViewHolder viewHolder = new ViewHolder();
        View rowView = inflater.inflate(R.layout.rowlayout, parent, false);
        TextView textView = (TextView) rowView.findViewById(R.id.txtlarge);
        textView.setText("hahhaha");

        return rowView;
    }

    private Drawable LoadImageFromWebOperations(String url)
    {
        try
        {
            InputStream is = (InputStream) new URL(url).getContent();
            Drawable d = Drawable.createFromStream(is, "src name");
            return d;
        } 
        catch (Exception e)
        {
            Log.w("LoadImageFromWebOperations",e.toString());
            return null;
        }
    }
}

My error is here:

07-09 02:20:47.433: E/AndroidRuntime(1168): FATAL EXCEPTION: main
07-09 02:20:47.433: E/AndroidRuntime(1168): java.lang.NullPointerException
07-09 02:20:47.433: E/AndroidRuntime(1168):     at com.database_demo.MySimpleArrayAdapter.getView(MySimpleArrayAdapter.java:57)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.AbsListView.obtainView(AbsListView.java:1315)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.ListView.makeAndAddView(ListView.java:1727)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.ListView.fillDown(ListView.java:652)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.ListView.fillFromTop(ListView.java:709)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.ListView.layoutChildren(ListView.java:1580)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.AbsListView.onLayout(AbsListView.java:1147)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.view.View.layout(View.java:7035)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.view.View.layout(View.java:7035)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.view.View.layout(View.java:7035)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.view.View.layout(View.java:7035)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.os.Looper.loop(Looper.java:123)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at java.lang.reflect.Method.invokeNative(Native Method)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at java.lang.reflect.Method.invoke(Method.java:521)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-09 02:20:47.433: E/AndroidRuntime(1168):     at dalvik.system.NativeStart.main(Native Method)

Please help thanks

  • 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-07T08:13:26+00:00Added an answer on June 7, 2026 at 8:13 am

    Replace

    View rowView = inflater.inflate(R.layout.rowlayout, parent, false);
    

    By

    View rowView = inflater.inflate(R.layout.rowlayout, null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view passing on information from a database: def serve_article(request, id): served_article
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I have a reasonable size flat file database of text documents mostly saved in

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.