English 中文(简体)
Android:具有参数
原标题:Android: Intent with parameters

将某一活动参数从一个活动转到另一个活动时,使用“intent.putExtra()”方法。

这种方法是否只允许增加原始数据,或者我能够增加一个小ava的参数?

如果你不能,我如何能够从一项活动向另一项活动发出一个ava灯?

感谢!

最佳回答

http://developer.android.com/fer/android/content/Intent.html” rel=“nofollow” 页: 1 如果你真心想要简单的反对,那么我会把你的好客改换成“智者”,把它做成“强者”,然后在接收结束时将其改成“正义与和平组织”。

问题回答

如果物体能够执行,你可以发送物体。

页: 1

public class Objeto implements Serializable{

}

招标活动:

 //create an instance of the object
Objeto object = new Objeto();
//creates an intent from the current activity to the destiny activity with the data to be     transferred.
Intent proximo = new Intent(this,TelaDestino.class); 
//transfers the object as a bundle to the next activity
proximo.putExtra("OBJETO",objeto);  
startActivity(proximo);

/ 预定活动:

private Objeto objeto;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

objeto = (Objeto)getIntent().getSerializableExtra("OBJETO");

}

/You can use that and be well :D

如果贵国的物体是可乘之机,你可以添加该物体。 与此类似。

i.putExtra(String key, Serializable Value);

Another way to share data between activities is extend the application class.

我的回答解释了如何加以利用。

https://stackoverflow.com/questions/7816974/getapplicaiton-return- oc-object-among-applicaitons/7817045#7817045>getApplicaiton Return which Object among applicaitons





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签