2013.8.12 startActivityForResult

1,今天遇到一个问题:startActivityForResult后,直接调用onActivityResult(),原来是与Activity的launchmode有关,发送和接受的Activity只能设置成标准模式。否则在log中会有

W/ActivityManager(203): Activity is launching as a new task, so cancelling activity result.
另外一个问题是,调用 startActivityForResult后,onActivityResult没有被调用,这与startActivityForResult(intent i,int requestcode)中requestcode有关,必须大于等于0.看源码会发现startActivity调用的也是startActivityForResult,其中的requestcode=-1.

参考:http://blog.csdn.net/gaomatrix/article/details/6732336

你可能感兴趣的:(2013.8.12 startActivityForResult)