I am getting null pointer exception even though I have placed the Null Check:
@Override
public ArrayList<DataCache> getData()
{
if(contentOf != null)
{
StoreData data = new StoreData(this);
if(data!=null)
{
ArrayList<DataCache> cacheOf = null;
System.out.println("Size of ContentOf"+contentOf.size());
for (int i=0;i<contentOf.size();i++)
{
System.out.println("Value of ContentOf"+contentOf.get(i).mFeed);
ArrayList<DataCache> cache = contentOf.get(i).mFeed.getData();
if (cache != null)
cacheOf.add(cache.get(i));
}
return cacheOf;
}
}
}
Exception:
02-03 10:19:18.770: E/AndroidRuntime(8680): FATAL EXCEPTION: main
02-03 10:19:18.770: E/AndroidRuntime(8680): java.lang.NullPointerException
02-03 10:19:18.770: E/AndroidRuntime(8680): at
com.activity.MainFragmentActivity.getData(MainFragmentActivity.java:198)