Skip to content Skip to sidebar Skip to footer

Nullpointerexception When Using Customlistadapter

I create CustomListAdapter in Android Appiclation. But i get this error NullPointerException when implement it. Here is my CustomListAdapter.java code : /** * */ package com.fan

Solution 1:

I think you didn't add AppController to your manifest:

 <application
        android:name=".AppController" //this one
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">

That's why onCreate never called and mInstance is null.

Solution 2:

I noticed that you use private List<com.fanjavaid.searchhttprequest.model.Menu> menuList = new ArrayList<com.fanjavaid.searchhttprequest.model.Menu>();, but you never actually add anything to that list before you call:

listView = (ListView) findViewById(R.id.list);
adapter = newCustomListAdapter(this, menuList);
listView.setAdapter(adapter);

You probably want to put something in that menuList

Solution 3:

add AppController(Activity request) to your manifest:

 <application
    android:name=".AppController" //this one
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

Post a Comment for "Nullpointerexception When Using Customlistadapter"