Android ListFragment conflicts with a type defined in the same file – Heights of Ignorance

Yesterday I stumbled upon below error while developing my Android application which also has a ListFragment

The import android.support.v4.app.ListFragment conflicts with a type defined in the same file

I had android-support-v4.jar in my libs folder and I was finding it
very difficult to understand what could go wrong in such a simple class.

And after taking a closer look it was heights of ignorance :),
see my class definition below:

import android.support.v4.app.ListFragment;

public class ListFragment extends ListFragment {

}

I had given my class name as ListFragment,
and compiler was correctly telling me what went wrong.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s