android - Update previous fragment after back button is pressed inside view pager -


imagine have activity fragment, has list of contacts , button create new contact.

when press button, second fragment placed (with .addtobackstack(null) , replace()) 2 fields contact creation , button save it.

i create new contact , press button.

edit

being more specific, project structured this:

mainactivity | | containerfragment | | |_ _ _ tab |        |_ _ _ fragment 1 |        | |        |_ _ _ fragment 2 |        | |        |_ _ _ fragment 3 |        | |        |_ _ _ ... |         |_ _ _ tab b |        |_ _ _ fragment 4 |        | |        |_ _ _ fragment 5 |        | |        |_ _ _ fragment 6 |        | |        |_ _ _ ... | |_ _ _ tab c |        |_ _ _ fragment 7 |        | |        |_ _ _ fragment 8 |        | |        |_ _ _ fragment 9 |        | |        |_ _ _ ... 

my problem fragment 2 able change things shown in fragment 1, after changing button, fragment 2 disappears, nothing being called on fragment 1. no onresume() or oncreateview(). doing wrong?

from contacts fragment can invoke

contacts fragment:

startactivityforresult(intent, add_todo_item_request); 

in addcontactfragment

...  button submitbutton = (button) findviewbyid(r.id.submitbutton);         submitbutton.setonclicklistener(new onclicklistener() {                  //manipulations data                  // package contact data intent             intent data = new intent();             todoitem.packageintent(contactname, contactnumber...);             setresult(activity.result_ok, data);                 finish(); } 

and in in our contacts fragment:

@override protected void onactivityresult(int requestcode, int resultcode, intent data) {     if (resultcode == result_ok && requestcode == add_todo_item_request) {         contact contact = new contact(data);         madapter.add(contact);     } } 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -