android - Passing Values from a Context View item to a new intent! -
sorry im new android, , im doing project want edit data item selected in listview. prob dont have idea on how pass data. select item, item of type projitems(a class construct item); has gets, string getname(), date getdata(),int getprec();
and here want start new activity:
public void oncreatecontextmenu(contextmenu menu,view v,contextmenu.contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); menu.setheadertitle("selected project"); menu.add(0, del, menu.none, r.string.remove); menu.add(0, edit, menu.none, r.string.edit).setintent(new intent(pm_list.this, pm_edit.class));//here want pass info menu.add(0, task_list, menu.none, r.string.task); menu.add(0, cancel, menu.none, r.string.cancel); }
this info want pass new activity later show on textview! please me, happy, , grateful if do! best regards joão azevedo
so can selected item underlaying adapter this.
adaptercontextmenuinfo info = (adaptercontextmenuinfo) item.getmenuinfo(); object my_item = getlistadapter().getitem((int) info.id);
and can pass activity using intent start this
intent intent = new intent(context, your_activity.class); bundle extras = new bundle(); extras.putserializable("obj_to_pass", my_item); intent.putextras(extras); startactivity(intent);
and activity in oncreate method this
bundle extras = getintent().getextras(); object my_obj = extras.getserializable("obj_to_pass");
Comments
Post a Comment