我正在尝试为用户显示一条 toast 消息,以显示他选择的项目。我已将列表作为来自另一个类的意图传递,并在代码如下的类中接收到它:
public class ListViewDelete extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_list_view_delete);
final Intent intent = getIntent();
final Bundle extras = getIntent().getExtras(); //gets the GWID
final MySQLitehelper dbhelper = new MySQLitehelper(this);
ArrayList<String> thelist = new ArrayList<String>(extras.getStringArrayList(SelectOptions.EXTRA_MESSAGE));
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,extras.getStringArrayList(SelectOptions.EXTRA_MESSAGE)));
}
public void onListItemClick(ListView parent, View view, int position, long id)
{
Toast.makeText(this, "You have selected", Toast.LENGTH_LONG).show();
}
}
在最后一个 onListItemClick 中,如何在“您已选择”之后自定义它,我可以从上面定义的 arraylist 项中输入值?