开发者

Sending a string using a bundle

I have two Activities, say Activity A and Activity B, which are both dialogs. When I click on a button on Activity A it triggers Activity B. When I'm on Activity B, I click on a button, which sends a string t开发者_StackOverflow社区o Activity A by using a bundle, which Activity A receives. When I go back to Activity B to send another string,it causes Activity A which is currently behind it to force close and not send the string. I'm not sure why this is.

Your help will be most appreciated Thank you.


If one of you activity is more central than the other, you should use startActivityForResult in it. It will call the second one, and one the second one finished it can communicate results and extra in a bundle too.

This model looks cleaner, at least more standard, than a loop between activities. Although what you do and the way you do it should also work.

Btw, your activities may have a dialog theme but they are not dialogs, no ?

Regards, Stéphane

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜