In android, press the back key to return the previous activity. How can I re-call the oncreate method of the previous activity ?, Androidoncreate
It is not called by default.
@ Override public void onBackPressed () {String titleStr = edittitle. getText (). toString (); String contentStr = editcontent. getText (). toString (); if (title. equals (titleStr) & content. equals (contentStr) {super. onBackPressed ();} else {// Delete this entry first, and then create a new entry (Delete according to the title) DataUtils. delData (title, this); // Add another piece of data to DataUtils. addData (titleStr, contentStr, this); Intent intent = new Intent (this, MainActivity. class); startActivity (intent );}
The oncreate method will not be called after if
After else, the data in the previous activity can be refreshed, if written in the oncreate method.
Http://xue163.com/588880/39060/390608984.html