"is not abstact and does not override abstract method."
Posted
by
Chris Bolton
on Stack Overflow
See other posts from Stack Overflow
or by Chris Bolton
Published on 2011-05-01T04:19:01Z
Indexed on
2012/10/18
17:02 UTC
Read the original article
Hit count: 356
android
So I'm pretty new to android development and have been trying to piece together some code bits. Here's what I have so far:
package com.teslaprime.prirt;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
import java.util.ArrayList;
import java.util.List;
public class TaskList extends Activity {
List<Task> model = new ArrayList<Task>();
ArrayAdapter<Task> adapter = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button add = (Button) findViewById(R.id.add);
add.setOnClickListener(onAdd);
ListView list = (ListView) findViewById(R.id.tasks);
adapter = new ArrayAdapter<Task>(this,android.R.layout.simple_list_item_1,model);
list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(View v, int position, long id) {
adapter.remove(position);
}
});}
private View.OnClickListener onAdd = new View.OnClickListener() {
public void onClick(View v) {
Task task = new Task();
EditText name = (EditText) findViewById(R.id.taskEntry);
task.name = name.getText().toString();
adapter.add(task);
}
};
}
and here are the errors I'm getting:
compile:
[javac] /opt/android-sdk/tools/ant/main_rules.xml:384: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 2 source files to /home/chris-kun/code/priRT/bin/classes
[javac] /home/chris-kun/code/priRT/src/com/teslaprime/prirt/TaskList.java:30: <anonymous com.teslaprime.prirt.TaskList$1> is not abstract and does not override abstract method onItemClick(android.widget.AdapterView<?>,android.view.View,int,long) in android.widget.AdapterView.OnItemClickListener
[javac] list.setOnItemClickListener(new OnItemClickListener() {
[javac] ^
[javac] /home/chris-kun/code/priRT/src/com/teslaprime/prirt/TaskList.java:32: remove(com.teslaprime.prirt.Task) in android.widget.ArrayAdapter<com.teslaprime.prirt.Task> cannot be applied to (int)
[javac] adapter.remove(position);
[javac] ^
[javac] 2 errors
BUILD FAILED
/opt/android-sdk/tools/ant/main_rules.xml:384: Compile failed; see the compiler error output for details.
Total time: 2 seconds
any ideas?
© Stack Overflow or respective owner