Show a dialog with two buttons and edit text.And you have to do something like this
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
AlertDialog.Builder alert = new AlertDialog.Builder(
Activity.this);
alert.setTitle("Rename");
final EditText input = new EditText(Activity.this);
alert.setView(input);
alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String srt1 = input.getEditableText().toString();
//update your listview here
}
});
alert.setNegativeButton("CANCEL",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
AlertDialog alertDialog = alert.create();
alertDialog.show();
return false;
}
});
}