java: passing around class instances?

  • From: mehgcap <mehgcap@xxxxxxxxx>
  • To: programmingblind <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 9 May 2010 14:50:47 -0400

Hi all,
I am working with Android (yet again). Because of the way Android
works, you cannot have a dialog created that takes arguments from the
parent; instead, you use a data structure called an intent, in which
you put everything the child needs to run. However, I have a
non-serializable object (intents only accept primitives, strings, and
serialized objects) which the child needs to access but which is
created in the parent. I want to know how I can give two separate
classes, one of which is the main class, access to the same instance
of an object? As a simple example, say we have object o, in class c.
Class a is the parent and has in it the line:
c obje=new c();

Now, class a's child, class b, needs access not just to class c, but
to the specific obj instance of c that was made in a. Is there a way
to let both classes share the same instance of an object without
serializing? I maybe could import a inside b, but a is the main file
(runs at application start) so I feel like that would not be a great
way of doing things. Any ideas or thoughts would be greatly
appreciated. I can post the android code if you want, but I am not
sure how much good it would do.

-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: