如何通过两款Android视图之间的数据?两款、视图、数据、Android

2023-09-12 06:08:37 作者:一人一半才是伴 //*

我有需要做下面的一个简单的应用:

I have a simple application that needs to do the following:

从主视图用户点击一个按钮,启动另一种观点。 新的视图,并从用户那里收集信息。 一旦用户点击了新的观点,我需要送的数据返回到原始视图确定。

我发现现在的问题是,一旦我使用StartActivity(含意向)或的setContentView(Resource.Layout.Main)是我的数据已经一去不复返了。我把我收集到一个全局变量中的信息,但是当我回到我的原始查看其再创造。

The problem I am finding is that once I use StartActivity (with an intent) or SetContentView (Resource.Layout.Main) is that my data is gone. I'm putting the information I collected in a global variable but when I get back to my originating view its being recreated.

我怎样才能通过这个数据返回到先前的观点,这样我可以更新一些UI控件?

How can I pass this data back to the originating view so that I can update some UI controls?

推荐答案

HTTP: //developer.android.com/training/basics/intents/result.html

你试过startActivityForResult。我猜那是你在找什么做的。

Have you tried startActivityForResult. I'm guessing that is what you're looking to do.