LifeInstructor
LifeInstructor

Reputation: 1610

ListAdapter error using @Override

I am getting error in Eclipse Juno with the following code:

FilmListAdapter listAdapter = new FilmListAdapter(this, 
        R.layout.film_list_items, data);
listViewInstance.setAdapter(listAdapter);

listViewInstance.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> getView, View view, int i, long l) {
        Toast.makeText(getApplicationContext(),
        "click is performed", Toast.LENGTH_SHORT)
        .show();
    }
});

When I add the @Override it gives me an error and does not compile. Without it, it compiles, but the click is not working.

Upvotes: 0

Views: 60

Answers (1)

Chirag Shah
Chirag Shah

Reputation: 3674

You need to set the default language in eclipse to Java 1.6.

This can be done by clicking Preferences -> Java -> Compiler and select the compiler compliance level of 1.6

Upvotes: 3

Related Questions