I have two simple Activities - Activity1: ListView from an Array Activity2: EditText for editing the clicked row in Activity1
When I edit the value in Activity2 and
On clicking the item in your first Activity, start your second Activity with startActivityForResult()
And then in Second Activity, after entering in EditText
, probably there is a button. And in onClick
of that button call,
intent.putExtra("edittextvalue", findViewById(R.id.edittext).getText().toString());
setResult(RESULT_OK, intent);
finish();
Now you come back to your first Activity and here you have to implement onActivityResult()
callback. You can extract data from that intent's extras and set that respective item in your array and call notifyDataSetChanged()
.
This is ideally how you should be doing it.
If you want more info on how to use startActivityForResult() try this link - http://manisivapuram.blogspot.in/2011/06/how-to-use-startactivityforresult.html