Hi,

I would like to pass an object from one activity to another activity.
Everything looks fine except it can't pass the ArrayList inside that
object.

Suppose I have such class

public class A implements Parcelable {
     public ArrayList<B> bList;

     /** Implement the rest of the Parcelable methods **/
}

In the main activity, I do this:

    A m_a  = new A();

    private View.OnClickListener m_AddTaskListener = new
View.OnClickListener() {
                @Override
                public void onClick(View v) {
                        Intent intent1= new Intent(MainActivity.this, 
TempActivity.class);

                        Bundle bundle = new Bundle();
                        bundle.putParcelable("ROOT", m_a);  // Assume some b 
objects are
added

                        taskInfoIntent.putExtras(bundle);

                        startActivity(intent1);
                }
        };

And in the TempActivity, I try to retrieve the object A but B is
empty:

        private View.OnClickListener m_SetTaskListener = new
View.OnClickListener() {

                @Override
                public void onClick(View v) {
                        Bundle bundle = getIntent().getExtras();
                        Root a = bundle.getParcelable("ROOT");

                        B b = a.bList.GetAt(0); // This function crash because 
bList is
empty

                }
        };


Do I miss something here?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to