Andorid在activity之间传递对象
要想在activity之间传递对象,可以使用全局的盒子 (1)定义一个类继承Application,在类里面把想要传递的对象的引用定义进去 public class MyDoubanApp extends Application { public NoteEntry ne; } (2)在清单配置文件中Application节点下面配置 android:name="MyDoubanApp" 属性 (3)在activity中赋值并开启新的activity, MyDoubanApp myApp = (MyDoubanApp) getApplication(); myApp.ne = ne; Intent intent = new Intent(getApplication(),NoteViewActivity.class); startActivity(intent); 这时在新的activity中通过 MyDoubanApp myapp = (MyDoubanApp) getApplication(); NoteEntry ne = myapp.ne; 就可以得到数据对象了