Passing data from New activity to old activity?

前端 未结 1 1752
星月不相逢
星月不相逢 2020-12-19 18:02

I am trying to receive data from new Activity to old Activity.

In other words, newer Activity must send intend data to old activity when it finishes.

I\'ve u

相关标签:
1条回答
  • 2020-12-19 18:59

    As CommonsWare wrote in his comment you are passing the same Intent back to your Activity that you used to start the Activity.

    Try something like the following code:

    Intent newIntent = new Intent();
    newIntent.putExtra(key, yourData)
    newIntent.putExtra(key2, moreData)
    
    setResult(resultcode, newIntent);
    

    In your case the Intent is only needed to store the data that is passed back. Therefor you can use the standard constructor.

    0 讨论(0)
提交回复
热议问题