-2

I am new at developing Android.I want to finish intent after getting values by getExtras onCreate() method of MainActivity.

EditDetailActivity(startActivity) ----> MainActivity(onCreate)


After I updated detail of the item on EditActivity, I am returning to the MainActivty and I update my listview on Mainactivity on onCreate method. Problem is here because it duplicates.

ChrisF
  • 134,786
  • 31
  • 255
  • 325
MUMBUÇOĞLU
  • 251
  • 1
  • 8
  • 24
  • 1
    Duplicate of: http://stackoverflow.com/questions/14848590/return-back-to-mainactivity-from-another-activity providing the answere to get back to the main activity – Baklap4 Dec 08 '14 at 19:38

1 Answers1

1

Simply call finish() in the activity that you want to finish

See http://developer.android.com/reference/android/app/Activity.html#finish()

In your case you probably want to call it right after you call startActivity() for MainActivity

Tim
  • 41,901
  • 18
  • 127
  • 145
  • I am sorry,the screen (MainActivity) expired after calling finish().My purpose is to clear putExtra values after startActivity(). – MUMBUÇOĞLU Dec 08 '14 at 19:48
  • That is not what your question says. Why do you even want to clear that? Its data is in the Bundle that is specific for that intent – Tim Dec 08 '14 at 19:49