Why can't I get my BaseAdapter to work, by using LayoutInflater in getView()? it keeps returning nullpointer exceptions
<p>It was working before but for an unknown reason, I keep having nullpointer exception now even if everything is ok. See by yourself if you can help :</p>

<pre><code>public class TestActivity extends ListActivity {

ArrayList&lt;String&gt; array;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);
    array = getsms();
    SMSadapter adapter = new SMSadapter(this, array);
    getListView().setAdapter(adapter);

    }

public class SMSadapter extends BaseAdapter {

    Context mcontext;
    ArrayList&lt;String&gt; marray;
    LayoutInflater inflater;

    public SMSadapter (Context context, ArrayList&lt;String&gt;array){

        mcontext = context;
        marray = array;
        inflater = LayoutInflater.from(context);

    }

    @Override
    public int getCount() {
        return marray.size();
    }

    @Override
    public Object getItem(int position) {
        return marray.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    public class ViewHolder {
        TextView text;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = new ViewHolder();
        if (convertView == null){
            convertView = inflater.inflate(R.layout.items, null);
            holder.text = (TextView)findViewById(R.id.text);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder)convertView.getTag();
        }

        holder.text.setText(marray.get(position));
        return convertView;
    }

}

public ArrayList&lt;String&gt; getsms(){
    Cursor cursor = getContentResolver().query(Uri.parse("content://sms/inbox"), new String[]{"address"}, null,null,null);
    cursor.moveToFirst();
    ArrayList&lt;String&gt; temp = new ArrayList&lt;String&gt;();
    while(cursor.moveToNext()){
        temp.add(cursor.getString(0));
    }
    return temp;

}
</code></pre>

<p>}</p>

<p>12-17 16:11:17.037: E/AndroidRuntime(558):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.view.View.measure(View.java:8313)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.view.View.measure(View.java:8313)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.view.View.measure(View.java:8313)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.os.Handler.dispatchMessage(Handler.java:99)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.os.Looper.loop(Looper.java:123)
12-17 16:11:17.037: E/AndroidRuntime(558):  at android.app.ActivityThread.main(ActivityThread.java:3683)
12-17 16:11:17.037: E/AndroidRuntime(558):  at java.lang.reflect.Method.invokeNative(Native Method)
12-17 16:11:17.037: E/AndroidRuntime(558):  at java.lang.reflect.Method.invoke(Method.java:507)
12-17 16:11:17.037: E/AndroidRuntime(558):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-17 16:11:17.037: E/AndroidRuntime(558):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-17 16:11:17.037: E/AndroidRuntime(558):  at dalvik.system.NativeStart.main(Native Method)
12-17 16:22:06.778: D/AndroidRuntime(587): Shutting down VM
12-17 16:22:06.778: W/dalvikvm(587): threadid=1: thread exiting with uncaught exception (group=0x40015560)
12-17 16:22:06.788: E/AndroidRuntime(587): FATAL EXCEPTION: main
12-17 16:22:06.788: E/AndroidRuntime(587): java.lang.NullPointerException
12-17 16:22:06.788: E/AndroidRuntime(587):  at com.test.TestActivity$SMSadapter.getView(TestActivity.java:74)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.AbsListView.obtainView(AbsListView.java:1430)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.ListView.measureHeightOfChildren(ListView.java:1216)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.ListView.onMeasure(ListView.java:1127)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.View.measure(View.java:8313)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.View.measure(View.java:8313)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.View.measure(View.java:8313)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.View.measure(View.java:8313)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.View.measure(View.java:8313)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.os.Handler.dispatchMessage(Handler.java:99)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.os.Looper.loop(Looper.java:123)
12-17 16:22:06.788: E/AndroidRuntime(587):  at android.app.ActivityThread.main(ActivityThread.java:3683)
12-17 16:22:06.788: E/AndroidRuntime(587):  at java.lang.reflect.Method.invokeNative(Native Method)
12-17 16:22:06.788: E/AndroidRuntime(587):  at java.lang.reflect.Method.invoke(Method.java:507)
12-17 16:22:06.788: E/AndroidRuntime(587):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-17 16:22:06.788: E/AndroidRuntime(587):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-17 16:22:06.788: E/AndroidRuntime(587):  at dalvik.system.NativeStart.main(Native Method)    </p>
