1. //Serializeable传递对象的方法
  2. public void SerializeMethod(){
  3. Person mPerson = new Person();
  4. mPerson.setName("frankie");
  5. mPerson.setAge(25);
  6. Intent mIntent = new Intent(this,ObjectTranDemo1.class);
  7. Bundle mBundle = new Bundle();
  8. mBundle.putSerializable(SER_KEY,mPerson);
  9. mIntent.putExtras(mBundle);
  10. startActivity(mIntent);
  11. }
  12. //Pacelable传递对象方法
  13. public void PacelableMethod(){
  14. Book mBook = new Book();
  15. mBook.setBookName("Android Tutor");
  16. mBook.setAuthor("Frankie");
  17. mBook.setPublishTime(2010);
  18. Intent mIntent = new Intent(this,ObjectTranDemo2.class);
  19. Bundle mBundle = new Bundle();
  20. mBundle.putParcelable(PAR_KEY, mBook);
  21. mIntent.putExtras(mBundle);
  22. startActivity(mIntent);
  23. }
  24. //铵钮点击事件响应

Activity传递对象的方法的更多相关文章

  1. 【java】值传递和引用传递---对象作为方法的参数传入属于哪种传递

    首先 这篇作为一个永久性的问题,欢迎大家讨论 其次,个人结论如下几条: ①Java有且只有一种传递,即 值传递 ②作为方法的参数传入,都是对原本的实参进行了copy ③只不过[实参]若是[基本数据类型 ...

  2. Intent传递对象的方法

    //传递对象 Bundle bundle = new Bundle(); intent = new Intent(getApplicationContext(), YourActivity.class ...

  3. 第二章——Serializable的使用(跨进程使用和Intent的传递对象)

    一.Serializable类(JAVA本身具有的) 简介:Serializable是一个接口. 作用:是JAVA提供的序列化接口,实现序列化和反序列化的操作. 二.跨进程使用 1.事前准备 publ ...

  4. Android中如何使用Intent在Activity之间传递对象[使用Serializable或者Parcelable]

    http://blog.csdn.net/cjjky/article/details/6441104 在Android中的不同Activity之间传递对象,我们可以考虑采用Bundle.putSeri ...

  5. Intent传递对象的两种方法(Serializable,Parcelable) (转)

    今天讲一下Android中Intent中如何传递对象,就我目前所知道的有两种方法,一种是Bundle.putSerializable(Key,Object);另一种是Bundle.putParcela ...

  6. Android中Intent传递对象的两种方法(Serializable,Parcelable)

    今天要给大家讲一下Android中 Intent中如何传递对象,就我目前所知道的有两种方法,一种是Bundle.putSerializable(Key,Object);另一种是 Bundle.putP ...

  7. [转]Android中Intent传递对象的两种方法(Serializable,Parcelable)

    http://blog.csdn.net/xyz_lmn/article/details/5908355 今天要给大家讲一下Android中Intent中如何传递对象,就我目前所知道的有两种方法,一种 ...

  8. Android高手进阶教程(十七)之---Android中Intent传递对象的两种方法(Serializable,Parcelable)!

    [转][原文] 大家好,好久不见,今天要给大家讲一下Android中Intent中如何传递对象,就我目前所知道的有两种方法,一种是Bundle.putSerializable(Key,Object); ...

  9. Android的Activity之间传对象的方法

    传值代码块 //Serializeable传递对象的方法 public void SerializeMethod(){ Person mPerson = new Person(); mPerson.s ...

随机推荐

  1. Mime Types

    Mime Types 1.http://www.freeformatter.com/mime-types-list.html 2.http://www.webmaster-toolkit.com/mi ...

  2. 为什么toString方法可以用来区分数组和对象?

    首先大家都应该知道在javascript中只有是对象都存在toString方法,将调用该方法的值转换为字符串返回,如下: var arr = [1, 2, 3]; console.log(arr.to ...

  3. Android核心分析之二十一Android应用框架之AndroidApplication

    Android Application Android提供给开发程序员的概念空间中Application只是一个松散的表征概念,没有多少实质上的表征.在Android实际空间中看不到实际意义上的应用程 ...

  4. Android隐式启动匹配:action,category,data

    简介 Android开发中,Activity,Service 和 BroadcastReceiver 启动有两种方式,显示启动和隐式启动. 为方便下面描述,我以Activity启动为例. 显示启动便是 ...

  5. wordpress学习一: 环境搭建

    原来想单独找个linux的机器搞套完整的环境,机器都找好了,环境搞了半天.搞完后,感觉环境什么的不重要,核心是学好php和wordpress,单独的环境维护还开发成本都不小,所以 还是采用 xampp ...

  6. lua 的 WriteFile 和 ReadFile

    lua 的 ReadFile 和 WriteFile 注意: lua 代码中的 string 可以包含二进制数据 string.len(str) 不会被 '\0' 截断 从 lua 传入 c 时: 需 ...

  7. 306. Additive Number

    题目: Additive number is a string whose digits can form additive sequence. A valid additive sequence s ...

  8. iOS:授权用户定位NSLocationManager的使用

    请求用户批准定位: 在iOS8,要想获得用户的位置,必须经过用户批准授权 开发者可以在Info.plist中添加两个配置项 –NSLocationAlwaysUsageDescription –NSL ...

  9. HDU5092——Seam Carving(动态规划+回溯)(2014上海邀请赛重现)

    Seam Carving DescriptionFish likes to take photo with his friends. Several days ago, he found that s ...

  10. SSIS ->> Logging

    SSIS提供了Event Handler之外的另一种方法捕捉Event和获取需要的信息,这种方法是Logging.SSIS的Logging针对不同的组件可以提供比Event Handler更多的Eve ...