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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:10:07+00:00 2026-06-10T12:10:07+00:00

I have a ListActivity class and inside it, I am using an ArrayAdapter to

  • 0

I have a ListActivity class and inside it, I am using an ArrayAdapter to fill the list. The problem is, when i try to start activity, it crashes with some error message below:

08-18 18:09:27.443: E/AndroidRuntime(480): FATAL EXCEPTION: main
08-18 18:09:27.443: E/AndroidRuntime(480): java.lang.NullPointerException
08-18 18:09:27.443: E/AndroidRuntime(480):  at com.arox.havayollari.ListAirlines$MyListAdapter.getView(ListAirlines.java:114)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.AbsListView.obtainView(AbsListView.java:1315)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.ListView.onMeasure(ListView.java:1109)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.View.measure(View.java:8171)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.RelativeLayout.measureChild(RelativeLayout.java:563)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:378)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.View.measure(View.java:8171)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.View.measure(View.java:8171)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.View.measure(View.java:8171)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.View.measure(View.java:8171)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.os.Looper.loop(Looper.java:123)
08-18 18:09:27.443: E/AndroidRuntime(480):  at android.app.ActivityThread.main(ActivityThread.java:4627)
08-18 18:09:27.443: E/AndroidRuntime(480):  at java.lang.reflect.Method.invokeNative(Native Method)
08-18 18:09:27.443: E/AndroidRuntime(480):  at java.lang.reflect.Method.invoke(Method.java:521)
08-18 18:09:27.443: E/AndroidRuntime(480):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-18 18:09:27.443: E/AndroidRuntime(480):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-18 18:09:27.443: E/AndroidRuntime(480):  at dalvik.system.NativeStart.main(Native Method)

Here is my custom arrayadapter code:

@Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub
            View view = convertView;

            if (view == null) {
                LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                inflater.inflate(R.layout.airline_item, null);
            }

            //It crashes at this line
            ImageView img = (ImageView) view.findViewById(R.id.imgAirline);


            TextView tview = (TextView) view.findViewById(R.id.tvAirline);
            tview.setText(lines[position].toString());


            return view;
        }

And my airline_item.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <ImageView
        android:id="@+id/imgAirline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/logo" />

    <TextView
        android:id="@+id/tvAirline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="Medium Text"
        android:layout_marginLeft="20dip"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</LinearLayout>

I really don’t understand what the problem is.
Any help is appreciated.

  • 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-10T12:10:09+00:00Added an answer on June 10, 2026 at 12:10 pm

    You are inflating a layout, but not into any View. This is how your inflate should work:

    if (view == null) {
        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.airline_item, null);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Activity class, ListActivity class, TabActivity class. I want expand these classes using
I am facing a problem. I have a Class that extends listactivity and its
I have a problem my ListActivity . I have this xml: <LinearLayout> <ListView android:id=@android:id/list
I have a ListActivity class, and when any item on the list is clicked,
I have written a ListActivity class that uses a custom ArrayAdapter and Holders. I
I currently have a ListActivity and I am looking to start a new activity
I have an activity: public class Notepadv1 extends ListActivity { public static final int
Currently I have a class that is extending the ListActivity class. I need to
I have a class defined as public class viewGroups extends ListActivity Somewhere in the
I have the next code : public class AddPrinter extends ListActivity { @Override public

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.