Passing object to another activity

Put your problem here if it does not fit any of the other categories.

Passing object to another activity

Postby Sharmila » Thu Jan 27, 2011 8:49 am


I am trying to pass the object of a bean class to another activity.
i have to tried to send it with singleton class with a hash map of weak references for object.
Code: Select all
      WeakReference personal=new WeakReference(impl.getBean());

i will store this weakreference of object and key value in the singleton class with the static put method.
i also have the static get method for accessing the data back wherever i need.

Now my doubt is: is this a optimal solution?

I have also come across another way to do the same with putSerializable(),getSerializable() by making the bean class implementing Serializable interface.
is this correct way?

But this is not suggested in ... ework.html
(How do I pass data between Activities/Services within a single application?)
Why it is not specified there?

How to pass the hashmap of weakreferences to object between the activities.
i cant pass it.
will you provide the sample code for it.
i have referred the article posted in this forum.
HashMap meMap=new HashMap();
Intent myIntent.putExtra("memap",meMap);
Intent getIntent=getIntent();

I have replaced the myStream with my object(bean class)
it is sent as serializable value.
while retrieving back am getting error.
How to retrieve the hashmap of weakreferences to object in another activity
but i can't do it.
I want to pass the data with out using serializable concept
Will you help to solve this problem
Posts: 5
Joined: Thu Jan 27, 2011 8:06 am


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 6 guests