My small test app is a ListActivity which displays all the contacts. When the user clicks one, it opens the "people" ACTION_EDIT activity. This works fine. When the user clicks "back" or finishes editing in some other way, the main "People" list activity starts, rather than returning to my activity.
Why is this happening?
Here's my code:
public class ReadContact extends ListActivity implements OnItemClickListener
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
...
}
@Override
public void onItemClick (AdapterView<?> parent, View view, int position, long id)
{
Cursor cur = ((SimpleCursorAdapter)parent.getAdapter()).getCursor();
cur.moveToPosition (position);
String key = cur.getString (2);
System.out.println ("clicked " + key);
// make intent to edit contact
Intent intent = new Intent (Intent.ACTION_EDIT);
intent.setData (Uri.parse (ContactsContract.Contacts.CONTENT_LOOKUP_URI + "/" + key));
startActivityForResult (intent, 2);
}
@Override
protected void onActivityResult (int requestCode, int resultCode, Intent data)
{
System.out.println ("request " + requestCode + ", result " + resultCode);
}
}
Note that onActivityResult is never called. Also please realize that I have no control over the contact editing code - that's part of the "people" app supplied with android. Thanks.