0

what is the best metod to send object between Activities? I've got something like this:

class dataSet {
   private String name;
        private String sName;
        .
        .
   private Vector<actv> activities;
   .
        .

   dataSet(){
      activities = new Vector<actv>();
   }
   void setName(String v){
      name = v;
   }
   String getName(){
      return this.name;
        .
        . etc.
   }

I want to send this object to activitie class.menu , how can I do it?

Mihaueq
  • 1
  • 1
  • 1
  • 1
    You are creating strong references to your Activities in this object. If you pass this object around then the garbage collector will not be able to collect the old Activities which may have been destroyed by the system (because of orientation change etc). You should only create a WeakReference to your Activity objects to avoid memory leaks. – Prashast Dec 30 '10 at 14:13

1 Answers1

0

Activity A: 1.create dataset instance; 2,set value in dataset;

`Intent intent =new Intent(......................);
Intent.putExtras("dataset",dataSet);
startactivity(intent);`

Activity B: 1,create dataset instance and initialize; 2,in onCreate() method, dataset=getIntent().getParcelable("dataset");

missing some letters coz I am using phone to type

Sen Luo
  • 1
  • 3