title: Update data in a previous activity when the user has edited some fields in another activity, onRestart?
body: <p>i create dynamic textviews in an activity with some fields returned by a webservice. When the user wants to edit some data, he is sent to another activity. When he clicks on the "back" button i want to update data in the previous activity but i don't know the right way to do. I use the onRestart method instead of onResume</p>
  
  <p>here is my code :</p>
  
  <p>My first activity which display data :</p>
  
  <pre><code>public class QueryActivity extends Activity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.query);
  
          new WSData() {
          @Override
          public void onPostExecute(final ArrayList&lt;ArrayList&lt;String&gt;&gt; result) {  int nbTextView = result.size();
              TextView[] textViewArray = new TextView[nbTextView];
  
              for (int i = 0; i &lt; nbTextView; i++) {
  
                  // Horizontal Layout to have the accountName and a button to
                  // edit on the same line
                  LinearLayout editLayout = new LinearLayout(
                          QueryActivity.this);
                  Button edit = new Button(QueryActivity.this);
                  edit.setBackgroundDrawable(getResources().getDrawable(
                          R.drawable.editer));
  
                  editLayout.removeAllViewsInLayout();
                  editLayout.setOrientation(LinearLayout.HORIZONTAL);
                  dynamicWindow.addView(editLayout,
                          new LinearLayout.LayoutParams(
                                  LinearLayout.LayoutParams.FILL_PARENT,
                                  LinearLayout.LayoutParams.WRAP_CONTENT));
  
                  textViewArray[i] = new TextView(QueryActivity.this);
  
                  // retrieve every field from the result
                  final String accountId = result.get(i).get(0);
                  final String accountName = result.get(i).get(1);
                  final String phone = result.get(i).get(2);
                  final String industry = result.get(i).get(3);
                  final String website = result.get(i).get(4);
  
  // display only the accountName
                  textViewArray[i].setText(accountName);
                  textViewArray[i].setTextColor(0xFFFFFFFF);
                  textViewArray[i].setGravity(Gravity.CENTER_VERTICAL);
                  textViewArray[i].setVisibility(View.VISIBLE);
  
                  edit.setOnClickListener(new OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          Intent intent = new Intent(QueryActivity.this,
                                  EditAccountActivity.class);
                                              startActivity(intent);
                      }
                  });
  }.execute(sessionName, null, "getAccountInfo"); 
  }
  
  
  @Override
  public void onRestart() {
      super.onRestart();
  
  }
  </code></pre>
  
  <p>my other activity, i want to update my data when i click on "back" :</p>
  
  <pre><code>public class EditAccountActivity extends Activity {                 
  back.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
               finish();
              }
      });
  </code></pre>