Hi,

I'm trying to run the example of ListView in this address:
http://developer.android.com/resources/tutorials/views/hello-listview.html

But I'm getting an error message for OnItemClickListener function:
"OnItemClickListener cannot be resolved to a type".

When I'm importing android.widget.AdapterView.OnItemClickListener
again I'm getting this error:
"The type new AdapterView.OnItemClickListener(){} must implement the
inherited abstract method
AdapterView.OnItemClickListener.onItemClick(AdapterView<?>, View, int,
long)"

This is the onCreate function:

@Override
        public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);

          setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item,
COUNTRIES));

          ListView lv = getListView();
          lv.setTextFilterEnabled(true);

          lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
              // When clicked, show a toast with the TextView text
              Toast.makeText(getApplicationContext(), ((TextView)
view).getText(),
                  Toast.LENGTH_SHORT).show();
            }
          });
        }

How can I solve this error?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to