android - how to send value through intent after finishing an activity -
i have activity shows gridview of items. when click in of them, move activity showing information of item. have option go (gridview activity) or delete it.
if delete it, need refresh gridview, need send variable saying "eey, have deleted item. need refresh".
i guess need open second activity startactivityforresult, don't know how should set value.
option 1 (back arrow): finishes activity. no result back. option 2 (delete item): finishes activity , sets result back.
thanks in advance!
you can set custom result. delete_item
.
on delete button :
public static int delete_item = 1234; intent intent = new intent(); intent.putextra("item_id", item id); setresult(delete_item , intent);
now on activity result :
@override protected void onactivityresult(int requestcode, int resultcode, intent intent) { if (resultcode == delete_item) { // code delete item super.onactivityresult(requestcode, resultcode, intent); } }
Comments
Post a Comment