我有一个recyclerview,里面有我从mysql数据库获得的项目。现在,我希望用户可以触摸其中一个项目并将其“保存”到本地。此保存的项目应添加到另一个名为“我的保存项目”的recyclerview布局中。这是我目前的代码:
recyclerViewadapter_artikel = new RecyclerViewKyoceraArtikel(GetDataAdapter1, this);
recyclerView.setAdapter(recyclerViewadapter_artikel);
recyclerView.addOnItemTouchListener(
new RecyclerItemClickListener(this, new RecyclerItemClickListener.OnItemClickListener() {
@Override public void onItemClick(final View view, int position) {
AlertDialog.Builder builder = new AlertDialog.Builder(Artikel.this);
builder.setItems(new CharSequence[]
{"Copy", "Save", "Open"},
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// The 'which' argument contains the index position
// of the selected item
switch (which) {
case 0:
break;
case 1:
break;
case 2:
Intent myIntent = new Intent(view.getContext(), Artikel.class);
startActivityForResult(myIntent, 0);
break;
}
}
});
builder.create().show();
}
}));
在案例1中,用户应该有机会保存此项目。
暂无答案!
目前还没有任何答案,快来回答吧!