setListAdapter not working


#1

I am trying to use setListAdapter(adapter) and I get an error saying Return type for the method is missing.How do I resolve this. I included all the relevant android imports(libraries) and I am still getting this error. What am I doing wrong?

Here is the code

CrimeAdapter adapter = new CrimeAdapter(mCrimes);
setListAdapter(adapter);


#2

I know this is an old post but for completions sake I had this same problem and couldn’t find the answer until I paid close attention to the code samples. It ended up being that I needed to change in CrimeListFragment.java

or whatever you have it extending to:


#3

I get the same error however I already have it extending to ListFragment:

AndroidStudio keeps showing an error that says “error:invalid method declaration, return type required”.

Any updates on this?


#4

I finally found the problem. It was a rogue curly bracket so no problem with “extends ListFragment”.