hey everyone,
i'm pretty new to programming for android, i'm using eclipse as my ide, and i'm having difficulty with anonymous inner classes. for instance, i'll simply copy/paste example code from android.com or write my own code and everything goes fine until i reach an anonymous class.
for example, i've copied/pasted the following from android.com:
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();
}
});
and the error occurs with OnItemClickListener() { ... on the first line. the problem description in eclipse reads, "OnItemClickListener cannot be resolved to a type."
any suggestions?
thanks everyone,
andrew
i'm pretty new to programming for android, i'm using eclipse as my ide, and i'm having difficulty with anonymous inner classes. for instance, i'll simply copy/paste example code from android.com or write my own code and everything goes fine until i reach an anonymous class.
for example, i've copied/pasted the following from android.com:
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();
}
});
and the error occurs with OnItemClickListener() { ... on the first line. the problem description in eclipse reads, "OnItemClickListener cannot be resolved to a type."
any suggestions?
thanks everyone,
andrew